The :class:`.MigrationContext` that's established for a
duration of a migration command is available via the
- :attr:`.EnvironmentContext.migration_context` datamember,
+ :meth:`.EnvironmentContext.get_context` method,
which is available at ``alembic.context``::
from alembic import context
- migration_context = context.migration_context
+ migration_context = context.get_context()
A :class:`.MigrationContext` can be created programmatically
for usage outside of the usual Alembic migrations flow,
in :ref:`sqlexpression_toplevel` as well as
for usage with the :meth:`sqlalchemy.schema.Table.create`
and :meth:`sqlalchemy.schema.MetaData.create_all` methods
- of :class:`.Table`, :class:`.MetaData`.
+ of :class:`~sqlalchemy.schema.Table`, :class:`~sqlalchemy.schema.MetaData`.
Note that when "standard output" mode is enabled,
this bind will be a "mock" connection handler that cannot
rel_t.append_column(schema.Column(cname, NULLTYPE))
def get_context(self):
- """Return the :class:`.MigrationsContext` object that's
+ """Return the :class:`.MigrationContext` object that's
currently in use.
"""
"""Return the current 'bind'.
Under normal circumstances, this is the
- :class:`sqlalchemy.engine.Connection` currently being used
+ :class:`~sqlalchemy.engine.base.Connection` currently being used
to emit SQL to the database.
In a SQL script context, this value is ``None``. [TODO: verify this]
is said to be *configured* with database connectivity, available via
a new :class:`.MigrationContext` object. The :class:`.MigrationContext`
is associated with the :class:`.EnvironmentContext` object
-via the :attr:`.EnvironmentContext.migration_context` datamember.
+via the :meth:`.EnvironmentContext.get_context` method.
Finally, ``env.py`` calls upon the :meth:`.EnvironmentContext.run_migrations`
method. Within this method, a new :class:`.Operations` object, which
objects. This so that migration instructions can be
given in terms of just the string names and/or flags involved.
The exceptions to this
-rule include the :meth:`~.Operations.add_column` and :func:`~.Operations.create_table`
+rule include the :meth:`~.Operations.add_column` and :meth:`~.Operations.create_table`
directives, which require full :class:`~sqlalchemy.schema.Column`
objects, though the table metadata is still generated here.