diff options
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() |