tiangolo / full-stack-fastapi-template

Full stack, modern web application template. Using FastAPI, React, SQLModel, PostgreSQL, Docker, GitHub Actions, automatic HTTPS and more.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: module 'app.db.engine' has no attribute '_run_ddl_visitor'

jpainam opened this issue · comments

My table was not yet created, so running without SQLModel.metadata.create_all(engine) says,

e 924, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "users" does not exist
LINE 2: FROM users 

Adding SQLModel.metadata.create_all(engine) gives

 File "~/backend/main.py", line 28, in <module>
    SQLModel.metadata.create_all(engine)
  File "~/anaconda3/envs/portal/lib/python3.10/site-packages/sqlalchemy/sql/schema.py", line 5825, in create_all
    bind._run_ddl_visitor(
AttributeError: module 'app.db.engine' has no attribute '_run_ddl_visitor'

from app.db.engine import engine works