Answer the question
In order to leave comments, you need to log in
Sqlite, sqlalchemy, empty db created?
Good afternoon.
I am writing a small stray for routine
The project uses sqlalchemy==1.1.5
I need to open an existing database and read data from there, there are no problems with this
I would like to take into account the situation when the user made a mistake in the path to the database file
I do this:
if os.path.exists(settings.DB_FILE):
BaseModel.metadata.create_all(engine)
Answer the question
In order to leave comments, you need to log in
How to make a query to a non-existent database not create an empty file
when trying to make a request from the GUI, it logs that the path is incorrect, but an empty database file is created,I didn’t understand a little, that is, here the program does not intercept the error and collapses? But does it work the way it should?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question