From b2df5be7ee8b5ee7ae67323b5018ca37bbf0ce2a Mon Sep 17 00:00:00 2001 From: jonathan vanasco Date: Mon, 27 Sep 2021 15:15:33 -0400 Subject: Deprecate create_engine.implicit_returning The :paramref:`_sa.create_engine.implicit_returning` parameter is deprecated on the :func:`_sa.create_engine` function only; the parameter remains available on the :class:`_schema.Table` object. This parameter was originally intended to enable the "implicit returning" feature of SQLAlchemy when it was first developed and was not enabled by default. Under modern use, there's no reason this parameter should be disabled, and it has been observed to cause confusion as it degrades performance and makes it more difficult for the ORM to retrieve recently inserted server defaults. The parameter remains available on :class:`_schema.Table` to specifically suit database-level edge cases which make RETURNING infeasible, the sole example currently being SQL Server's limitation that INSERT RETURNING may not be used on a table that has INSERT triggers on it. Also removed from the Oracle dialect some logic that would upgrade an Oracle 8/8i server version to use implicit returning if the parameter were explictly passed; these versions of Oracle still support RETURNING so the feature is now enabled for all Oracle versions. Fixes: #6962 Change-Id: Ib338e300cd7c8026c3083043f645084a8211aed8 --- lib/sqlalchemy/testing/suite/test_insert.py | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'lib/sqlalchemy/testing/suite') diff --git a/lib/sqlalchemy/testing/suite/test_insert.py b/lib/sqlalchemy/testing/suite/test_insert.py index 3c22f50b2..080bb486e 100644 --- a/lib/sqlalchemy/testing/suite/test_insert.py +++ b/lib/sqlalchemy/testing/suite/test_insert.py @@ -1,5 +1,3 @@ -from .. import config -from .. import engines from .. import fixtures from ..assertions import eq_ from ..config import requirements @@ -19,8 +17,6 @@ class LastrowidTest(fixtures.TablesTest): __requires__ = "implements_get_lastrowid", "autoincrement_insert" - __engine_options__ = {"implicit_returning": False} - @classmethod def define_tables(cls, metadata): Table( @@ -30,6 +26,7 @@ class LastrowidTest(fixtures.TablesTest): "id", Integer, primary_key=True, test_needs_autoincrement=True ), Column("data", String(50)), + implicit_returning=False, ) Table( @@ -37,6 +34,7 @@ class LastrowidTest(fixtures.TablesTest): metadata, Column("id", Integer, primary_key=True, autoincrement=False), Column("data", String(50)), + implicit_returning=False, ) def _assert_round_trip(self, table, conn): @@ -110,18 +108,10 @@ class InsertBehaviorTest(fixtures.TablesTest): ) @requirements.autoincrement_insert - def test_autoclose_on_insert(self): - if requirements.returning.enabled: - engine = engines.testing_engine( - options={"implicit_returning": False} - ) - else: - engine = config.db - - with engine.begin() as conn: - r = conn.execute( - self.tables.autoinc_pk.insert(), dict(data="some data") - ) + def test_autoclose_on_insert(self, connection): + r = connection.execute( + self.tables.autoinc_pk.insert(), dict(data="some data") + ) assert r._soft_closed assert not r.closed assert r.is_insert @@ -306,8 +296,6 @@ class ReturningTest(fixtures.TablesTest): __requires__ = "returning", "autoincrement_insert" __backend__ = True - __engine_options__ = {"implicit_returning": True} - def _assert_round_trip(self, table, conn): row = conn.execute(table.select()).first() eq_( -- cgit v1.2.1