[sqlalchemy-20] Use Connection.execute() instead of Engine.execute()
According to the SLQAlchemy documentation, "the Engine.execute() method is considered legacy as of the 1.x series of SQLAlchemy and will be removed in 2.0. All statement execution in SQLAlchemy 2.0 is performed by the Connection.execute() method of Connection, or in the ORM by the Session.execute() method of Session." Change-Id: Ic4d7a0740f7136cac2055e57e57f66e76cb150f3 Closes-Bug: #2008223
This commit is contained in:
parent
23fa6b3c2f
commit
444cec2ba0
@ -100,13 +100,10 @@ class _EnableSQLiteFKsFixture(fixtures.Fixture):
|
||||
|
||||
def _setUp(self):
|
||||
if self.engine.name == 'sqlite':
|
||||
self.engine.execute("PRAGMA foreign_keys=ON")
|
||||
|
||||
def disable_fks():
|
||||
with self.engine.connect() as conn:
|
||||
conn.connection.rollback()
|
||||
conn.execute("PRAGMA foreign_keys=OFF")
|
||||
self.addCleanup(disable_fks)
|
||||
with self.engine.connect() as conn:
|
||||
cursor = conn.connection.cursor()
|
||||
cursor.execute('PRAGMA foreign_keys=ON')
|
||||
cursor.close()
|
||||
|
||||
|
||||
class SqlFixture(fixtures.Fixture):
|
||||
|
Loading…
Reference in New Issue
Block a user