Replace "Inspector.from_engine()" with "sqlalchemy.inspect()"
Since SQLAlchemy 1.4, the method "Inspector.from_engine()" is deprecated. This patch is related to [1]. [1]https://review.opendev.org/c/openstack/neutron/+/808103 Related-Bug: #1943155 Change-Id: Ic26da2e20c0878204cf9565e173b4825cb36f34c
This commit is contained in:
parent
732c1dcbc2
commit
d7ba5948ff
|
@ -47,8 +47,7 @@ def get_inspector():
|
|||
if _INSPECTOR:
|
||||
return _INSPECTOR
|
||||
else:
|
||||
bind = op.get_bind()
|
||||
_INSPECTOR = sa.engine.reflection.Inspector.from_engine(bind)
|
||||
_INSPECTOR = sa.inspect(op.get_bind())
|
||||
|
||||
return _INSPECTOR
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ def upgrade():
|
|||
|
||||
|
||||
def clear_constraints_and_foreign():
|
||||
inspect = sa.engine.reflection.Inspector.from_engine(op.get_bind())
|
||||
inspect = sa.inspect(op.get_bind())
|
||||
foreign_keys = inspect.get_foreign_keys(PF_TABLE_NAME)
|
||||
migration.remove_foreign_keys(PF_TABLE_NAME,
|
||||
foreign_keys)
|
||||
|
|
Loading…
Reference in New Issue