requirement.
The engine can be used directly to issue SQL to the database. The most generic
-way is first procure a connection resource, which you get via the :class:`connect` method::
+way is first procure a connection resource, which you get via the
+:meth:`.Engine.connect` method::
connection = engine.connect()
result = connection.execute("select username from users")
on behalf of a particular mapped class, though the :class:`.Session`
also features its own explicit system of establishing complex :class:`.Engine`/
mapped class configurations.
-* The :meth:`.MetaData.create_all`, :meth:`.Metadata.drop_all`, :meth:`.Table.create`,
+* The :meth:`.MetaData.create_all`, :meth:`.MetaData.drop_all`, :meth:`.Table.create`,
:meth:`.Table.drop`, and "autoload" features all make usage of the bound
:class:`.Engine` automatically without the need to pass it explicitly.
db.rollback()
Explicit execution can be mixed with connectionless execution by
-using the :class:`.Engine.connect` method to acquire a :class:`.Connection`
+using the :meth:`.Engine.connect` method to acquire a :class:`.Connection`
that is not part of the threadlocal scope::
db.begin()
Note that any key/value can be passed to
:meth:`.Connection.execution_options`, and it will be stored in the
- ``_execution_options`` dictionary of the :class:`.Connnection`. It
+ ``_execution_options`` dictionary of the :class:`.Connection`. It
is suitable for usage by end-user schemes to communicate with
event listeners, for example.
class Engine(Connectable, log.Identified):
"""
Connects a :class:`~sqlalchemy.pool.Pool` and
- :class:`~sqlalchemy.engine.Dialect` together to provide a source
- of database connectivity and behavior.
+ :class:`~sqlalchemy.engine.interfaces.Dialect` together to provide a
+ source of database connectivity and behavior.
An :class:`.Engine` object is instantiated publicly using the
:func:`~sqlalchemy.create_engine` function.
@property
def name(self):
- """String name of the :class:`~sqlalchemy.engine.Dialect` in use by
- this ``Engine``."""
+ """String name of the :class:`~sqlalchemy.engine.interfaces.Dialect`
+ in use by this :class:`Engine`."""
return self.dialect.name
@property
def driver(self):
- """Driver name of the :class:`~sqlalchemy.engine.Dialect` in use by
- this ``Engine``."""
+ """Driver name of the :class:`~sqlalchemy.engine.interfaces.Dialect`
+ in use by this :class:`Engine`."""
return self.dialect.driver
supports "returning" and the insert statement executed
with the "implicit returning" enabled.
- Raises :class:`.InvalidRequestError` if the executed
+ Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed
statement is not a compiled expression construct
or is not an insert() construct.
"""Return the collection of updated parameters from this
execution.
- Raises :class:`.InvalidRequestError` if the executed
+ Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed
statement is not a compiled expression construct
or is not an update() construct.
"""Return the collection of inserted parameters from this
execution.
- Raises :class:`.InvalidRequestError` if the executed
+ Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed
statement is not a compiled expression construct
or is not an insert() construct.
See :class:`.ExecutionContext` for details.
- Raises :class:`.InvalidRequestError` if the executed
+ Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed
statement is not a compiled expression construct
or is not an insert() or update() construct.
See :class:`.ExecutionContext` for details.
- Raises :class:`.InvalidRequestError` if the executed
+ Raises :class:`~sqlalchemy.exc.InvalidRequestError` if the executed
statement is not a compiled expression construct
or is not an insert() or update() construct.
Compiling sub-elements of a custom expression construct
=======================================================
-The ``compiler`` argument is the :class:`~sqlalchemy.engine.base.Compiled`
-object in use. This object can be inspected for any information about the
-in-progress compilation, including ``compiler.dialect``,
-``compiler.statement`` etc. The :class:`~sqlalchemy.sql.compiler.SQLCompiler`
-and :class:`~sqlalchemy.sql.compiler.DDLCompiler` both include a ``process()``
+The ``compiler`` argument is the
+:class:`~sqlalchemy.engine.interfaces.Compiled` object in use. This object
+can be inspected for any information about the in-progress compilation,
+including ``compiler.dialect``, ``compiler.statement`` etc. The
+:class:`~sqlalchemy.sql.compiler.SQLCompiler` and
+:class:`~sqlalchemy.sql.compiler.DDLCompiler` both include a ``process()``
method which can be used for compilation of embedded attributes::
from sqlalchemy.sql.expression import Executable, ClauseElement