Q: SQLAlchemy (sqlite3.OperationalError) no such table: I'm using SQLAlchemy to connect to an in-memory SQLite database.
In my main.py file I have
engine = create_engine('sqlite:///:memory:', echo = True)
Base.metadata.create_all(engine)
Session = sessionmaker(bind=engine)
sess = Session()

After this I create a new thread, where I pass the session to
thread = MyThread(sess)
thread.start()

I have created my tables in tables.py like this
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Float

Base = declarative_base()

class My_Entry(Base):
    __tablename__ = 'my_entry'

    id = Column(Integer, primary_key=True)
    name = Column(String)
    url = Column(String)

My_Thread looks like this
class MyThread(Thread):
    def __init__(sess):
        Thread.__init__(self)
        self.sess = sess
def run(self):
    last_entry_url = self.sess.query(My_Entry).filter_by(name=key).all()[-1]

I try to query the database in the run function of my thread
last_entry_url = self.sess.query(My_Entry).filter_by(name=key).all()[-1]

but this throws an error
(sqlite3.OperationalError) no such table: my_entry

But creating the tables is one of the first things I do?
Indeed, using the echo=True gives me
CREATE TABLE my_entry (
    id INTEGER NOT NULL, 
    name VARCHAR, 
    url VARCHAR, 
    PRIMARY KEY (id)
)

I have a sleep statement before running MyThread. My other tables work just fine, it's only this one table that doesn't.
bonus question: is there another way to get the last entry instead of all()[-1]? I assume there is but I didn't find anything
