[sqlalchemy-20] The Connection.connect() method is considered legacy

Change-Id: I5eaf60426e10c15ac16800ce1962d6690ff80f92
Related-Bug: #2008227
This commit is contained in:
elajkat 2023-02-24 17:02:17 +01:00
parent c5882990f6
commit 9aef6c4e03
2 changed files with 2 additions and 2 deletions

View File

@ -60,7 +60,7 @@ def check_sanity(connection):
insp = sa.engine.reflection.Inspector.from_engine(connection)
if 'firewall_groups_v2' not in insp.get_table_names():
return []
session = sa.orm.Session(bind=connection.connect())
session = sa.orm.Session(bind=connection)
default_fwg = session.query(resources.FIREWALL_GROUP.name).filter(
resources.FIREWALL_GROUP.name == const.DEFAULT_FWG).first()
if default_fwg:

View File

@ -64,7 +64,7 @@ def get_duplicate_port_records_in_fwg_port_association(connection):
insp = sa.engine.reflection.Inspector.from_engine(connection)
if 'firewall_group_port_associations_v2' not in insp.get_table_names():
return []
session = sa.orm.Session(bind=connection.connect())
session = sa.orm.Session(bind=connection)
query = (session.query(fwg_port_association.c.port_id)
.group_by(fwg_port_association.c.port_id)
.having(sa.func.count() > 1)).all()