Base = declarative_base(bind=engine) How do I migrate this statment to SQLAlchemy 2.0

163 views Asked by At

During the testing (pytest), the below line gives the warning.

Base = declarative_base(bind=engine) 

I have imported declarative_base from from sqlalchemy.orm.

I am also using Base later to initialize the tables in the database.

Base.metadata.create_all(bind=engine)

RemovedIn20Warning: Deprecated API features detected! These feature(s) are not compatible with SQLAlchemy 2.0. To prevent incompatible upgrades prior to updating applications, ensure requirements files are pinned to "sqlalchemy<2.0". Set environment variable SQLALCHEMY_WARN_20=1 to show all deprecation warnings. Set environment variable SQLALCHEMY_SILENCE_UBER_WARNING=1 to silence this message. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)

0

There are 0 answers