Merge "Don't pass kwargs to connection.execute()"

This commit is contained in:
Zuul 2021-11-12 18:46:06 +00:00 committed by Gerrit Code Review
commit 20181ab78f
4 changed files with 9 additions and 11 deletions

View File

@ -604,9 +604,11 @@ class PostgresqlBackendImpl(BackendImpl):
return bool(
engine.scalar(
sqlalchemy.text(
"SELECT datname FROM pg_database "
"WHERE datname=:name"), name=ident)
"SELECT datname FROM pg_database WHERE datname=:name"
),
{'name': ident},
)
)
def _close_out_database_users(self, conn, ident):
"""Attempt to guarantee a database can be dropped.
@ -630,7 +632,9 @@ class PostgresqlBackendImpl(BackendImpl):
"WHERE usename=current_user AND "
"pid != pg_backend_pid() AND "
"datname=:dname"
), dname=ident)
),
{'dname': ident},
)
def _random_ident():

View File

@ -1118,7 +1118,7 @@ def get_non_innodb_tables(connectable, skip_tables=('migrate_version',
params['database'] = connectable.engine.url.database
query = text(query_str)
noninnodb = connectable.execute(query, **params)
noninnodb = connectable.execute(query, params)
return [i[0] for i in noninnodb]

View File

@ -52,11 +52,6 @@ class WarningsFixture(fixtures.Fixture):
message=r'The Engine.execute\(\) method is considered legacy .*',
category=sqla_exc.SADeprecationWarning)
warnings.filterwarnings(
'once',
message=r'The connection.execute\(\) method in SQLAlchemy 2.0 .*',
category=sqla_exc.SADeprecationWarning)
warnings.filterwarnings(
'once',
message=r'Calling the mapper\(\) function directly outside .*',

View File

@ -324,8 +324,7 @@ class MySQLModeTestCase(db_test_base._MySQLOpportunisticTestCase):
def _test_string_too_long(self, value):
with self.connection.begin():
self.connection.execute(self.test_table.insert(),
bar=value)
self.connection.execute(self.test_table.insert(), {'bar': value})
result = self.connection.execute(self.test_table.select())
return result.fetchone().bar