]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Structural / performance refinements
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 21 May 2020 22:18:39 +0000 (18:18 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 22 May 2020 14:30:38 +0000 (10:30 -0400)
* state connection schema_translate_map entirely in terms of
  execution options, support for per-execution options as well

* use slots for role impls, remove superclass of the roles
  themselves as this is not needed

* tighten loop in resolve, might become a C function

Change-Id: Ib98ac9b65022fbf976e49c6060e4c37573528c5f

lib/sqlalchemy/engine/base.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/sql/coercions.py
test/engine/test_execute.py

index bbfafe8f15b130653605968c55d9f8e5fc9bc932..c477c4292565fb945a932e01c094c8a10063985e 100644 (file)
@@ -52,7 +52,6 @@ class Connection(Connectable):
 
     """
 
-    _schema_translate_map = None
     _is_future = False
     _sqla_logger_namespace = "sqlalchemy.engine.Connection"
 
@@ -82,7 +81,6 @@ class Connection(Connectable):
             self.should_close_with_result = False
             self.dispatch = _dispatch
             self._has_events = _branch_from._has_events
-            self._schema_translate_map = _branch_from._schema_translate_map
         else:
             self._dbapi_connection = (
                 connection
@@ -112,6 +110,10 @@ class Connection(Connectable):
         if self._has_events or self.engine._has_events:
             self.dispatch.engine_connect(self, _branch_from is not None)
 
+    @property
+    def _schema_translate_map(self):
+        return self._execution_options.get("schema_translate_map", None)
+
     def schema_for_object(self, obj):
         """return the schema name for the given schema item taking into
         account current schema translate map.
@@ -119,7 +121,9 @@ class Connection(Connectable):
         """
 
         name = obj.schema
-        schema_translate_map = self._schema_translate_map
+        schema_translate_map = self._execution_options.get(
+            "schema_translate_map", None
+        )
 
         if (
             schema_translate_map
@@ -1107,10 +1111,13 @@ class Connection(Connectable):
                     self, ddl, multiparams, params, execution_options
                 )
 
+        exec_opts = self._execution_options.merge_with(execution_options)
+        schema_translate_map = exec_opts.get("schema_translate_map", None)
+
         dialect = self.dialect
 
         compiled = ddl.compile(
-            dialect=dialect, schema_translate_map=self._schema_translate_map
+            dialect=dialect, schema_translate_map=schema_translate_map
         )
         ret = self._execute_context(
             dialect,
@@ -1147,9 +1154,9 @@ class Connection(Connectable):
 
         dialect = self.dialect
 
-        exec_opts = self._execution_options
-        if execution_options:
-            exec_opts = exec_opts.union(execution_options)
+        exec_opts = self._execution_options.merge_with(execution_options)
+
+        schema_translate_map = exec_opts.get("schema_translate_map", None)
 
         if "compiled_cache" in exec_opts:
             elem_cache_key = elem._generate_cache_key()
@@ -1162,7 +1169,7 @@ class Connection(Connectable):
                 dialect,
                 cache_key,
                 tuple(sorted(keys)),
-                bool(self._schema_translate_map),
+                bool(schema_translate_map),
                 len(distilled_params) > 1,
             )
             cache = exec_opts["compiled_cache"]
@@ -1174,7 +1181,7 @@ class Connection(Connectable):
                     cache_key=elem_cache_key,
                     column_keys=keys,
                     inline=len(distilled_params) > 1,
-                    schema_translate_map=self._schema_translate_map,
+                    schema_translate_map=schema_translate_map,
                     linting=self.dialect.compiler_linting
                     | compiler.WARN_LINTING,
                 )
@@ -1186,7 +1193,7 @@ class Connection(Connectable):
                 dialect=dialect,
                 column_keys=keys,
                 inline=len(distilled_params) > 1,
-                schema_translate_map=self._schema_translate_map,
+                schema_translate_map=schema_translate_map,
                 linting=self.dialect.compiler_linting | compiler.WARN_LINTING,
             )
 
@@ -1364,9 +1371,6 @@ class Connection(Connectable):
             # the only feature that branching provides
             self = self.__branch_from
 
-        if execution_options:
-            dialect.set_exec_execution_options(self, execution_options)
-
         try:
             conn = self._dbapi_connection
             if conn is None:
index 094ab3d55310dc12b9387da12b9585be4a8e7dbf..52651aa2d041f0b17d691537bbc0dda410a9fdba 100644 (file)
@@ -499,34 +499,10 @@ class DefaultDialect(interfaces.Dialect):
                 if not branch:
                     self._set_connection_isolation(connection, isolation_level)
 
-        if "schema_translate_map" in opts:
-            engine._schema_translate_map = map_ = opts["schema_translate_map"]
-
-            @event.listens_for(engine, "engine_connect")
-            def set_schema_translate_map(connection, branch):
-                connection._schema_translate_map = map_
-
     def set_connection_execution_options(self, connection, opts):
         if "isolation_level" in opts:
             self._set_connection_isolation(connection, opts["isolation_level"])
 
-        if "schema_translate_map" in opts:
-            connection._schema_translate_map = opts["schema_translate_map"]
-
-    def set_exec_execution_options(self, connection, opts):
-        if "isolation_level" in opts:
-            raise exc.InvalidRequestError(
-                "The 'isolation_level' execution "
-                "option is not supported at the per-statement level"
-            )
-            self._set_connection_isolation(connection, opts["isolation_level"])
-
-        if "schema_translate_map" in opts:
-            raise exc.InvalidRequestError(
-                "The 'schema_translate_map' execution "
-                "option is not supported at the per-statement level"
-            )
-
     def _set_connection_isolation(self, connection, level):
         if connection.in_transaction():
             if connection._is_future:
@@ -765,9 +741,13 @@ class DefaultExecutionContext(interfaces.ExecutionContext):
 
         self.unicode_statement = util.text_type(compiled)
         if compiled.schema_translate_map:
+            schema_translate_map = self.execution_options.get(
+                "schema_translate_map", {}
+            )
+
             rst = compiled.preparer._render_schema_translates
             self.unicode_statement = rst(
-                self.unicode_statement, connection._schema_translate_map
+                self.unicode_statement, schema_translate_map
             )
 
         if not dialect.supports_unicode_statements:
@@ -894,9 +874,12 @@ class DefaultExecutionContext(interfaces.ExecutionContext):
             positiontup = self.compiled.positiontup
 
         if compiled.schema_translate_map:
+            schema_translate_map = self.execution_options.get(
+                "schema_translate_map", {}
+            )
             rst = compiled.preparer._render_schema_translates
             self.unicode_statement = rst(
-                self.unicode_statement, connection._schema_translate_map
+                self.unicode_statement, schema_translate_map
             )
 
         # final self.unicode_statement is now assigned, encode if needed
index fc168aa1de5d72f41c63b23779d41b0fef4a350b..c7b85c4154f3f60fa117743fa3b971453d8b52fe 100644 (file)
@@ -108,29 +108,27 @@ class RoleImpl(object):
 
     def _resolve_for_clause_element(self, element, argname=None, **kw):
         original_element = element
-        is_clause_element = hasattr(element, "__clause_element__")
+
+        is_clause_element = False
+        while hasattr(element, "__clause_element__"):
+            is_clause_element = True
+            if not getattr(element, "is_clause_element", False):
+                element = element.__clause_element__()
+            else:
+                return element
 
         if is_clause_element:
-            while not isinstance(
-                element, (elements.ClauseElement, schema.SchemaItem)
-            ):
+            return element
+
+        if self._use_inspection:
+            insp = inspection.inspect(element, raiseerr=False)
+            if insp is not None:
                 try:
-                    element = element.__clause_element__()
+                    return insp.__clause_element__()
                 except AttributeError:
-                    break
-
-        if not is_clause_element:
-            if self._use_inspection:
-                insp = inspection.inspect(element, raiseerr=False)
-                if insp is not None:
-                    try:
-                        return insp.__clause_element__()
-                    except AttributeError:
-                        self._raise_for_expected(original_element, argname)
-
-            return self._literal_coercion(element, argname=argname, **kw)
-        else:
-            return element
+                    self._raise_for_expected(original_element, argname)
+
+        return self._literal_coercion(element, argname=argname, **kw)
 
     def _implicit_coercions(self, element, resolved, argname=None, **kw):
         self._raise_for_expected(element, argname, resolved)
@@ -160,6 +158,8 @@ class RoleImpl(object):
 
 
 class _Deannotate(object):
+    __slots__ = ()
+
     def _post_coercion(self, resolved, **kw):
         from .util import _deep_deannotate
 
@@ -167,11 +167,15 @@ class _Deannotate(object):
 
 
 class _StringOnly(object):
+    __slots__ = ()
+
     def _resolve_for_clause_element(self, element, argname=None, **kw):
         return self._literal_coercion(element, **kw)
 
 
 class _ReturnsStringKey(object):
+    __slots__ = ()
+
     def _implicit_coercions(
         self, original_element, resolved, argname=None, **kw
     ):
@@ -185,6 +189,8 @@ class _ReturnsStringKey(object):
 
 
 class _ColumnCoercions(object):
+    __slots__ = ()
+
     def _warn_for_scalar_subquery_coercion(self):
         util.warn_deprecated(
             "coercing SELECT object to scalar subquery in a "
@@ -230,6 +236,8 @@ def _no_text_coercion(
 
 
 class _NoTextCoercion(object):
+    __slots__ = ()
+
     def _literal_coercion(self, element, argname=None, **kw):
         if isinstance(element, util.string_types) and issubclass(
             elements.TextClause, self._role_class
@@ -240,6 +248,7 @@ class _NoTextCoercion(object):
 
 
 class _CoerceLiterals(object):
+    __slots__ = ()
     _coerce_consts = False
     _coerce_star = False
     _coerce_numerics = False
@@ -269,6 +278,8 @@ class _CoerceLiterals(object):
 
 
 class _SelectIsNotFrom(object):
+    __slots__ = ()
+
     def _raise_for_expected(self, element, argname=None, resolved=None, **kw):
         if isinstance(element, roles.SelectStatementRole) or isinstance(
             resolved, roles.SelectStatementRole
@@ -292,9 +303,9 @@ class _SelectIsNotFrom(object):
         )
 
 
-class ExpressionElementImpl(
-    _ColumnCoercions, RoleImpl, roles.ExpressionElementRole
-):
+class ExpressionElementImpl(_ColumnCoercions, RoleImpl):
+    __slots__ = ()
+
     def _literal_coercion(
         self, element, name=None, type_=None, argname=None, is_crud=False, **kw
     ):
@@ -309,9 +320,10 @@ class ExpressionElementImpl(
                 self._raise_for_expected(element, err=err)
 
 
-class BinaryElementImpl(
-    ExpressionElementImpl, RoleImpl, roles.BinaryElementRole
-):
+class BinaryElementImpl(ExpressionElementImpl, RoleImpl):
+
+    __slots__ = ()
+
     def _literal_coercion(
         self, element, expr, operator, bindparam_type=None, argname=None, **kw
     ):
@@ -326,7 +338,9 @@ class BinaryElementImpl(
         return resolved
 
 
-class InElementImpl(RoleImpl, roles.InElementRole):
+class InElementImpl(RoleImpl):
+    __slots__ = ()
+
     def _implicit_coercions(
         self, original_element, resolved, argname=None, **kw
     ):
@@ -390,9 +404,8 @@ class InElementImpl(RoleImpl, roles.InElementRole):
             return element
 
 
-class WhereHavingImpl(
-    _CoerceLiterals, _ColumnCoercions, RoleImpl, roles.WhereHavingRole
-):
+class WhereHavingImpl(_CoerceLiterals, _ColumnCoercions, RoleImpl):
+    __slots__ = ()
 
     _coerce_consts = True
 
@@ -400,9 +413,8 @@ class WhereHavingImpl(
         return _no_text_coercion(element, argname)
 
 
-class StatementOptionImpl(
-    _CoerceLiterals, RoleImpl, roles.StatementOptionRole
-):
+class StatementOptionImpl(_CoerceLiterals, RoleImpl):
+    __slots__ = ()
 
     _coerce_consts = True
 
@@ -410,25 +422,27 @@ class StatementOptionImpl(
         return elements.TextClause(element)
 
 
-class ColumnArgumentImpl(_NoTextCoercion, RoleImpl, roles.ColumnArgumentRole):
-    pass
+class ColumnArgumentImpl(_NoTextCoercion, RoleImpl):
+    __slots__ = ()
 
 
-class ColumnArgumentOrKeyImpl(
-    _ReturnsStringKey, RoleImpl, roles.ColumnArgumentOrKeyRole
-):
-    pass
+class ColumnArgumentOrKeyImpl(_ReturnsStringKey, RoleImpl):
+    __slots__ = ()
 
 
 class ByOfImpl(_CoerceLiterals, _ColumnCoercions, RoleImpl, roles.ByOfRole):
 
+    __slots__ = ()
+
     _coerce_consts = True
 
     def _text_coercion(self, element, argname=None):
         return elements._textual_label_reference(element)
 
 
-class OrderByImpl(ByOfImpl, RoleImpl, roles.OrderByRole):
+class OrderByImpl(ByOfImpl, RoleImpl):
+    __slots__ = ()
+
     def _post_coercion(self, resolved):
         if (
             isinstance(resolved, self._role_class)
@@ -439,7 +453,9 @@ class OrderByImpl(ByOfImpl, RoleImpl, roles.OrderByRole):
             return resolved
 
 
-class DMLColumnImpl(_ReturnsStringKey, RoleImpl, roles.DMLColumnRole):
+class DMLColumnImpl(_ReturnsStringKey, RoleImpl):
+    __slots__ = ()
+
     def _post_coercion(self, element, as_key=False):
         if as_key:
             return element.key
@@ -447,7 +463,9 @@ class DMLColumnImpl(_ReturnsStringKey, RoleImpl, roles.DMLColumnRole):
             return element
 
 
-class ConstExprImpl(RoleImpl, roles.ConstExprRole):
+class ConstExprImpl(RoleImpl):
+    __slots__ = ()
+
     def _literal_coercion(self, element, argname=None, **kw):
         if element is None:
             return elements.Null()
@@ -459,7 +477,9 @@ class ConstExprImpl(RoleImpl, roles.ConstExprRole):
             self._raise_for_expected(element, argname)
 
 
-class TruncatedLabelImpl(_StringOnly, RoleImpl, roles.TruncatedLabelRole):
+class TruncatedLabelImpl(_StringOnly, RoleImpl):
+    __slots__ = ()
+
     def _implicit_coercions(
         self, original_element, resolved, argname=None, **kw
     ):
@@ -482,9 +502,9 @@ class TruncatedLabelImpl(_StringOnly, RoleImpl, roles.TruncatedLabelRole):
             return elements._truncated_label(element)
 
 
-class DDLExpressionImpl(
-    _Deannotate, _CoerceLiterals, RoleImpl, roles.DDLExpressionRole
-):
+class DDLExpressionImpl(_Deannotate, _CoerceLiterals, RoleImpl):
+
+    __slots__ = ()
 
     _coerce_consts = True
 
@@ -492,17 +512,17 @@ class DDLExpressionImpl(
         return elements.TextClause(element)
 
 
-class DDLConstraintColumnImpl(
-    _Deannotate, _ReturnsStringKey, RoleImpl, roles.DDLConstraintColumnRole
-):
-    pass
+class DDLConstraintColumnImpl(_Deannotate, _ReturnsStringKey, RoleImpl):
+    __slots__ = ()
 
 
 class DDLReferredColumnImpl(DDLConstraintColumnImpl):
-    pass
+    __slots__ = ()
+
 
+class LimitOffsetImpl(RoleImpl):
+    __slots__ = ()
 
-class LimitOffsetImpl(RoleImpl, roles.LimitOffsetRole):
     def _implicit_coercions(self, element, resolved, argname=None, **kw):
         if resolved is None:
             return None
@@ -519,9 +539,9 @@ class LimitOffsetImpl(RoleImpl, roles.LimitOffsetRole):
             )
 
 
-class LabeledColumnExprImpl(
-    ExpressionElementImpl, roles.LabeledColumnExprRole
-):
+class LabeledColumnExprImpl(ExpressionElementImpl):
+    __slots__ = ()
+
     def _implicit_coercions(
         self, original_element, resolved, argname=None, **kw
     ):
@@ -537,9 +557,8 @@ class LabeledColumnExprImpl(
                 self._raise_for_expected(original_element, argname, resolved)
 
 
-class ColumnsClauseImpl(
-    _SelectIsNotFrom, _CoerceLiterals, RoleImpl, roles.ColumnsClauseRole
-):
+class ColumnsClauseImpl(_SelectIsNotFrom, _CoerceLiterals, RoleImpl):
+    __slots__ = ()
 
     _coerce_consts = True
     _coerce_numerics = True
@@ -566,22 +585,26 @@ class ColumnsClauseImpl(
         )
 
 
-class ReturnsRowsImpl(RoleImpl, roles.ReturnsRowsRole):
-    pass
+class ReturnsRowsImpl(RoleImpl):
+    __slots__ = ()
 
 
-class StatementImpl(_NoTextCoercion, RoleImpl, roles.StatementRole):
-    pass
+class StatementImpl(_NoTextCoercion, RoleImpl):
+    __slots__ = ()
 
 
-class CoerceTextStatementImpl(_CoerceLiterals, RoleImpl, roles.StatementRole):
+class CoerceTextStatementImpl(_CoerceLiterals, RoleImpl):
+    __slots__ = ()
+
     def _text_coercion(self, element, argname=None):
+        # TODO: this should emit deprecation warning,
+        # see deprecation warning in engine/base.py execute()
         return elements.TextClause(element)
 
 
-class SelectStatementImpl(
-    _NoTextCoercion, RoleImpl, roles.SelectStatementRole
-):
+class SelectStatementImpl(_NoTextCoercion, RoleImpl):
+    __slots__ = ()
+
     def _implicit_coercions(
         self, original_element, resolved, argname=None, **kw
     ):
@@ -595,9 +618,9 @@ class HasCTEImpl(ReturnsRowsImpl, roles.HasCTERole):
     pass
 
 
-class FromClauseImpl(
-    _SelectIsNotFrom, _NoTextCoercion, RoleImpl, roles.FromClauseRole
-):
+class FromClauseImpl(_SelectIsNotFrom, _NoTextCoercion, RoleImpl):
+    __slots__ = ()
+
     def _implicit_coercions(
         self,
         original_element,
@@ -625,7 +648,9 @@ class FromClauseImpl(
             self._raise_for_expected(original_element, argname, resolved)
 
 
-class StrictFromClauseImpl(FromClauseImpl, roles.StrictFromClauseRole):
+class StrictFromClauseImpl(FromClauseImpl):
+    __slots__ = ()
+
     def _implicit_coercions(
         self,
         original_element,
@@ -647,14 +672,16 @@ class StrictFromClauseImpl(FromClauseImpl, roles.StrictFromClauseRole):
             self._raise_for_expected(original_element, argname, resolved)
 
 
-class AnonymizedFromClauseImpl(
-    StrictFromClauseImpl, roles.AnonymizedFromClauseRole
-):
+class AnonymizedFromClauseImpl(StrictFromClauseImpl):
+    __slots__ = ()
+
     def _post_coercion(self, element, flat=False, name=None, **kw):
         return element.alias(name=name, flat=flat)
 
 
-class DMLSelectImpl(_NoTextCoercion, RoleImpl, roles.DMLSelectRole):
+class DMLSelectImpl(_NoTextCoercion, RoleImpl):
+    __slots__ = ()
+
     def _implicit_coercions(
         self, original_element, resolved, argname=None, **kw
     ):
@@ -670,9 +697,9 @@ class DMLSelectImpl(_NoTextCoercion, RoleImpl, roles.DMLSelectRole):
             self._raise_for_expected(original_element, argname, resolved)
 
 
-class CompoundElementImpl(
-    _NoTextCoercion, RoleImpl, roles.CompoundElementRole
-):
+class CompoundElementImpl(_NoTextCoercion, RoleImpl):
+    __slots__ = ()
+
     def _raise_for_expected(self, element, argname=None, resolved=None, **kw):
         if isinstance(element, roles.FromClauseRole):
             if element._is_subquery:
index 285dd2acf700a35ca73c2991a6db874844c81edf..9fa34ca0019537c6870f22b69d1a7d2bf5c113f0 100644 (file)
@@ -1090,6 +1090,101 @@ class SchemaTranslateTest(fixtures.TestBase, testing.AssertsExecutionResults):
         is_false(insp.has_table("t2", schema=config.test_schema))
         is_false(insp.has_table("t3", schema=None))
 
+    @testing.provide_metadata
+    def test_option_on_execute(self):
+        self._fixture()
+
+        map_ = {
+            None: config.test_schema,
+            "foo": config.test_schema,
+            "bar": None,
+        }
+
+        metadata = MetaData()
+        t1 = Table("t1", metadata, Column("x", Integer))
+        t2 = Table("t2", metadata, Column("x", Integer), schema="foo")
+        t3 = Table("t3", metadata, Column("x", Integer), schema="bar")
+
+        with self.sql_execution_asserter(config.db) as asserter:
+            with config.db.connect() as conn:
+
+                execution_options = {"schema_translate_map": map_}
+                conn._execute_20(
+                    t1.insert(), {"x": 1}, execution_options=execution_options
+                )
+                conn._execute_20(
+                    t2.insert(), {"x": 1}, execution_options=execution_options
+                )
+                conn._execute_20(
+                    t3.insert(), {"x": 1}, execution_options=execution_options
+                )
+
+                conn._execute_20(
+                    t1.update().values(x=1).where(t1.c.x == 1),
+                    execution_options=execution_options,
+                )
+                conn._execute_20(
+                    t2.update().values(x=2).where(t2.c.x == 1),
+                    execution_options=execution_options,
+                )
+                conn._execute_20(
+                    t3.update().values(x=3).where(t3.c.x == 1),
+                    execution_options=execution_options,
+                )
+
+                eq_(
+                    conn._execute_20(
+                        select([t1.c.x]), execution_options=execution_options
+                    ).scalar(),
+                    1,
+                )
+                eq_(
+                    conn._execute_20(
+                        select([t2.c.x]), execution_options=execution_options
+                    ).scalar(),
+                    2,
+                )
+                eq_(
+                    conn._execute_20(
+                        select([t3.c.x]), execution_options=execution_options
+                    ).scalar(),
+                    3,
+                )
+
+                conn._execute_20(
+                    t1.delete(), execution_options=execution_options
+                )
+                conn._execute_20(
+                    t2.delete(), execution_options=execution_options
+                )
+                conn._execute_20(
+                    t3.delete(), execution_options=execution_options
+                )
+
+        asserter.assert_(
+            CompiledSQL("INSERT INTO [SCHEMA__none].t1 (x) VALUES (:x)"),
+            CompiledSQL("INSERT INTO [SCHEMA_foo].t2 (x) VALUES (:x)"),
+            CompiledSQL("INSERT INTO [SCHEMA_bar].t3 (x) VALUES (:x)"),
+            CompiledSQL(
+                "UPDATE [SCHEMA__none].t1 SET x=:x WHERE "
+                "[SCHEMA__none].t1.x = :x_1"
+            ),
+            CompiledSQL(
+                "UPDATE [SCHEMA_foo].t2 SET x=:x WHERE "
+                "[SCHEMA_foo].t2.x = :x_1"
+            ),
+            CompiledSQL(
+                "UPDATE [SCHEMA_bar].t3 SET x=:x WHERE "
+                "[SCHEMA_bar].t3.x = :x_1"
+            ),
+            CompiledSQL("SELECT [SCHEMA__none].t1.x FROM [SCHEMA__none].t1"),
+            CompiledSQL("SELECT [SCHEMA_foo].t2.x FROM [SCHEMA_foo].t2"),
+            CompiledSQL("SELECT [SCHEMA_bar].t3.x FROM [SCHEMA_bar].t3"),
+            CompiledSQL("DELETE FROM [SCHEMA__none].t1"),
+            CompiledSQL("DELETE FROM [SCHEMA_foo].t2"),
+            CompiledSQL("DELETE FROM [SCHEMA_bar].t3"),
+        )
+
     @testing.provide_metadata
     def test_crud(self):
         self._fixture()
@@ -2966,25 +3061,6 @@ class FutureExecuteTest(fixtures.FutureEngineMixin, fixtures.TablesTest):
 
         eq_(opts, [expected])
 
-    def test_execution_opts_invoke_illegal(self, connection):
-        assert_raises_message(
-            tsa.exc.InvalidRequestError,
-            "The 'isolation_level' execution option is not supported "
-            "at the per-statement level",
-            connection.execute,
-            select([1]),
-            execution_options={"isolation_level": "AUTOCOMMIT"},
-        )
-
-        assert_raises_message(
-            tsa.exc.InvalidRequestError,
-            "The 'schema_translate_map' execution option is not supported "
-            "at the per-statement level",
-            connection.execute,
-            select([1]),
-            execution_options={"schema_translate_map": {}},
-        )
-
     def test_no_branching(self, connection):
         assert_raises_message(
             NotImplementedError,