Do not use deperecated MetaData.bind
Sqlaclhemy metadata bind is deperecated from version 1.4 and will be removed in SQLAlchemy 2.0 [1]. It can be easily replaced with metadata reflect which works for SQLAlchemy 2.0. Also current metadata.bind does not result in fetching all tables from the database, so metadata.tables is an empty mapping, which leads to db_sync failures. [1] https://docs.sqlalchemy.org/en/14/core/metadata.html#sqlalchemy.schema.MetaData.bind [2] https://docs.sqlalchemy.org/en/14/core/reflection.html#reflecting-all-tables-at-once Change-Id: I2b6f5f7e58567759b631baad87861d3a135f60fa
This commit is contained in:
parent
a5c28aeec3
commit
4125b34e0a
|
@ -23,7 +23,7 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
def is_migration_needed(equivalent_revision):
|
||||
metadata = sa.MetaData()
|
||||
metadata.bind = op.get_bind()
|
||||
metadata.reflect(bind=op.get_bind())
|
||||
|
||||
if 'migrate_version' not in metadata.tables.keys():
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue