'SQLite reports that my table does not exist, even though I can find it manually
I am building a simple application, mostly based on the Python Flask tutorial. When trying to create data in my SQLite database, I consistently receive an error saying that my table doesn't exist:
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: user
[SQL: INSERT INTO user (username, password, salt, email) VALUES (?, ?, ?, ?)]
[parameters: (redacted)
(Background on this error at: https://sqlalche.me/e/14/e3q8)
In order to debug this error, I have added the following line just before the line that throws the exception:
print(db.metadata.tables)
And inexplicably, this metadata shows that my user table does exist:
FacadeDict({'user': Table('user', MetaData(), Column('id', Integer(), table=<user>, primary_key=True, nullable=False), Column('username', String(length=80), table=<user>, nullable=False), Column('password', String(length=100), table=<user>, nullable=False), Column('salt', String(length=100), table=<user>, nullable=False), Column('email', String(length=120), table=<user>), schema=None))
I have been going in circles trying to figure out why this might be happening, but the conflicting debug information is making me run out of ideas. Is there something obvious that I might be overlooking, or am I misunderstanding the error?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
