admin管理员组

文章数量:1186154

# Database setup

DATABASE_URL = postgresql+psycopg2://....

engine = create_engine(
    DATABASE_URL, future=True
)

SessionLocal = sessionmaker(
    autocommit=False, autoflush=False, bind=engine, future=True
)

Base = declarative_base()

def get_database():
    db = SessionLocal()
    try:
        yield db
    finally:
        db.close()


I get this error after executing command alembic revision --autogenerate -m "initial migrations":

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.InvalidSchemaName) no schema has been selected to create in LINE 2: CREATE TABLE alembic_version ( .......

How can I fix this?

本文标签: pythonProblem with setting up Alembic with FastAPI and PostgresqlStack Overflow