Skip to content

Commit 1eeded1

Browse files
committed
update DDL examples removing execute_if
Fixes: sqlalchemy#7924 Change-Id: I684bf3720010ffe34dbdd39ec8c7e0c4af94e620
1 parent 952383f commit 1eeded1

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

lib/sqlalchemy/ext/compiler.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,19 @@ def compile(element, compiler, **kw):
229229
raise TypeError("coalesce only supports two arguments on Oracle")
230230
return "nvl(%s)" % compiler.process(element.clauses, **kw)
231231
232-
* :class:`~sqlalchemy.schema.DDLElement` - The root of all DDL expressions,
233-
like CREATE TABLE, ALTER TABLE, etc. Compilation of ``DDLElement``
234-
subclasses is issued by a ``DDLCompiler`` instead of a ``SQLCompiler``.
235-
``DDLElement`` also features ``Table`` and ``MetaData`` event hooks via the
236-
``execute_at()`` method, allowing the construct to be invoked during CREATE
237-
TABLE and DROP TABLE sequences.
232+
* :class:`.DDLElement` - The root of all DDL expressions,
233+
like CREATE TABLE, ALTER TABLE, etc. Compilation of :class:`.DDLElement`
234+
subclasses is issued by a :class:`.DDLCompiler` instead of a
235+
:class:`.SQLCompiler`. :class:`.DDLElement` can also be used as an event hook
236+
in conjunction with event hooks like :meth:`.DDLEvents.before_create` and
237+
:meth:`.DDLEvents.after_create`, allowing the construct to be invoked
238+
automatically during CREATE TABLE and DROP TABLE sequences.
239+
240+
.. seealso::
241+
242+
:ref:`metadata_ddl_toplevel` - contains examples of associating
243+
:class:`.DDL` objects (which are themselves :class:`.DDLElement`
244+
instances) with :class:`.DDLEvents` event hooks.
238245
239246
* :class:`~sqlalchemy.sql.expression.Executable` - This is a mixin which
240247
should be used with any expression class that represents a "standalone"

lib/sqlalchemy/sql/ddl.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,10 @@ def __init__(self, statement, context=None):
345345
346346
:param statement:
347347
A string or unicode string to be executed. Statements will be
348-
processed with Python's string formatting operator. See the
349-
``context`` argument and the ``execute_at`` method.
348+
processed with Python's string formatting operator using
349+
a fixed set of string substitutions, as well as additional
350+
substitutions provided by the optional :paramref:`.DDL.context`
351+
parameter.
350352
351353
A literal '%' in a statement must be escaped as '%%'.
352354

0 commit comments

Comments
 (0)