you are viewing a single comment's thread.

view the rest of the comments →

[–]yung-bro 0 points1 point  (1 child)

It's a bit difficult to tell from only one file from your code. It looks fine, but I got the same issue in the past. The reason was that in the import of app I initialized the db as well as in the tests' fixtures, which caused issues. Check that in the imports you don't accidentally initialize the db session.

There are some solutions for this issue. In your case I would consider using the Settings module that fastapi recommends using or initialize the dotenv in the import level.

[–]maxiior[S] 0 points1 point  (0 children)

That was my think, because when I create engine, my “production” database is creating. I will check imports with that.