From ba5cbf9366e9b2c5ed8e27e91815d7a2c3b63e41 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 15 Nov 2020 16:58:50 -0500 Subject: correct for "autocommit" deprecation warning Ensure no autocommit warnings occur internally or within tests. Also includes fixes for SQL Server full text tests which apparently have not been working at all for a long time, as it used long removed APIs. CI has not had fulltext running for some years and is now installed. Change-Id: Id806e1856c9da9f0a9eac88cebc7a94ecc95eb96 --- lib/sqlalchemy/engine/base.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'lib/sqlalchemy/engine') diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index 9a5518a96..028af9fbb 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -840,7 +840,15 @@ class Connection(Connectable): def _commit_impl(self, autocommit=False): assert not self.__branch_from - if autocommit: + # AUTOCOMMIT isolation-level is a dialect-specific concept, however + # if a connection has this set as the isolation level, we can skip + # the "autocommit" warning as the operation will do "autocommit" + # in any case + if ( + autocommit + and self._execution_options.get("isolation_level", None) + != "AUTOCOMMIT" + ): util.warn_deprecated_20( "The current statement is being autocommitted using " "implicit autocommit, which will be removed in " @@ -2687,9 +2695,11 @@ class Engine(Connectable, log.Identified): self.pool = self.pool.recreate() self.dispatch.engine_disposed(self) - def _execute_default(self, default): + def _execute_default( + self, default, multiparams=(), params=util.EMPTY_DICT + ): with self.connect() as conn: - return conn._execute_default(default, (), {}) + return conn._execute_default(default, multiparams, params) @contextlib.contextmanager def _optional_conn_ctx_manager(self, connection=None): -- cgit v1.2.1