diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-10-30 14:44:55 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-10-31 15:37:08 -0400 |
| commit | aa026c302c6b188a7e28508f9ecb603809b9e03f (patch) | |
| tree | bf4de51d5f585dc5b8b07b2b584b6182ab7aab3a /lib/sqlalchemy/engine/interfaces.py | |
| parent | cdce33e2ccb60365f12eb07c0b86fdc2b89b5033 (diff) | |
| download | sqlalchemy-aa026c302c6b188a7e28508f9ecb603809b9e03f.tar.gz | |
2.0 removals: LegacyRow, connectionless execution, close_with_result
in order to remove LegacyRow / LegacyResult, we have
to also lose close_with_result, which connectionless
execution relies upon.
also includes a new profiles.txt file that's all against
py310, as that's what CI is on now. some result counts
changed by one function call which was enough to fail the
low-count result tests.
Replaces Connectable as the common interface between
Connection and Engine with EngineEventsTarget. Engine
is no longer Connectable. Connection and MockConnection
still are.
References: #7257
Change-Id: Iad5eba0313836d347e65490349a22b061356896a
Diffstat (limited to 'lib/sqlalchemy/engine/interfaces.py')
| -rw-r--r-- | lib/sqlalchemy/engine/interfaces.py | 57 |
1 files changed, 22 insertions, 35 deletions
diff --git a/lib/sqlalchemy/engine/interfaces.py b/lib/sqlalchemy/engine/interfaces.py index d1484718e..11e55e425 100644 --- a/lib/sqlalchemy/engine/interfaces.py +++ b/lib/sqlalchemy/engine/interfaces.py @@ -7,7 +7,6 @@ """Define core interfaces used by the engine system.""" -from .. import util from ..sql.compiler import Compiled # noqa from ..sql.compiler import TypeCompiler # noqa @@ -1320,9 +1319,7 @@ class ExecutionContext(object): root_connection. root_connection - Connection object which is the source of this ExecutionContext. This - Connection may have close_with_result=True set, in which case it can - only be used once. + Connection object which is the source of this ExecutionContext. dialect dialect which created this ExecutionContext. @@ -1527,48 +1524,43 @@ class ExecutionContext(object): raise NotImplementedError() -@util.deprecated_20_cls( - ":class:`.Connectable`", - alternative=( - "The :class:`_engine.Engine` will be the only Core " - "object that features a .connect() method, and the " - ":class:`_engine.Connection` will be the only object that features " - "an .execute() method." - ), - constructor=None, -) -class Connectable(object): - """Interface for an object which supports execution of SQL constructs. +class ConnectionEventsTarget: + """An object which can accept events from :class:`.ConnectionEvents`. - The two implementations of :class:`.Connectable` are - :class:`_engine.Connection` and :class:`_engine.Engine`. + Includes :class:`_engine.Connection` and :class:`_engine.Engine`. - Connectable must also implement the 'dialect' member which references a - :class:`.Dialect` instance. + .. versionadded:: 2.0 """ - def connect(self, **kwargs): - """Return a :class:`_engine.Connection` object. - Depending on context, this may be ``self`` if this object - is already an instance of :class:`_engine.Connection`, or a newly - procured :class:`_engine.Connection` if this object is an instance - of :class:`_engine.Engine`. +class Connectable(ConnectionEventsTarget): + """Interface for an object which supports execution of SQL constructs. + + This is the base for :class:`_engine.Connection` and similar objects. - """ + .. versionchanged:: 2.0 :class:`_engine.Connectable` is no longer the + base class for :class:`_engine.Engine`, replaced with + :class:`_engine.ConnectionEventsTarget`. + + """ engine = None """The :class:`_engine.Engine` instance referred to by this :class:`.Connectable`. - May be ``self`` if this is already an :class:`_engine.Engine`. + """ + + dialect = None + """The :class:`_engine.Dialect` instance referred to by this + :class:`.Connectable`. """ def execute(self, object_, *multiparams, **params): """Executes the given construct and returns a - :class:`_engine.CursorResult`. + :class:`_result.Result`. + """ raise NotImplementedError() @@ -1576,13 +1568,8 @@ class Connectable(object): """Executes and returns the first column of the first row. The underlying cursor is closed after execution. - """ - raise NotImplementedError() - def _run_visitor(self, visitorcallable, element, **kwargs): - raise NotImplementedError() - - def _execute_clauseelement(self, elem, multiparams=None, params=None): + """ raise NotImplementedError() |
