diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2021-10-31 20:48:33 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2021-10-31 20:48:33 +0000 |
commit | f5956e13d5bc456802a09a0ed89b3c596161e390 (patch) | |
tree | d02b0e34e549c9b00aaad6fef25edf7f000380e6 /lib/sqlalchemy/engine/interfaces.py | |
parent | a1adb21cbe83ecce467194ab0e3277db581dfa4d (diff) | |
parent | aa026c302c6b188a7e28508f9ecb603809b9e03f (diff) | |
download | sqlalchemy-f5956e13d5bc456802a09a0ed89b3c596161e390.tar.gz |
Merge "2.0 removals: LegacyRow, connectionless execution, close_with_result" into main
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 fdaeaddcd..3fd245e44 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 @@ -1327,9 +1326,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. @@ -1534,48 +1531,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() @@ -1583,13 +1575,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() |