]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
update DDL examples removing execute_if
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 9 Apr 2022 14:02:35 +0000 (10:02 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 9 Apr 2022 14:02:35 +0000 (10:02 -0400)
Fixes: #7924
Change-Id: I684bf3720010ffe34dbdd39ec8c7e0c4af94e620

lib/sqlalchemy/ext/compiler.py
lib/sqlalchemy/sql/ddl.py

index f087b7f7a3dc0027837634c8701b3bfe0c79f2bd..b8265e88e70e00d8a00088526174741709eb708c 100644 (file)
@@ -229,12 +229,19 @@ A synopsis is as follows:
               raise TypeError("coalesce only supports two arguments on Oracle")
           return "nvl(%s)" % compiler.process(element.clauses, **kw)
 
-* :class:`~sqlalchemy.schema.DDLElement` - The root of all DDL expressions,
-  like CREATE TABLE, ALTER TABLE, etc. Compilation of ``DDLElement``
-  subclasses is issued by a ``DDLCompiler`` instead of a ``SQLCompiler``.
-  ``DDLElement`` also features ``Table`` and ``MetaData`` event hooks via the
-  ``execute_at()`` method, allowing the construct to be invoked during CREATE
-  TABLE and DROP TABLE sequences.
+* :class:`.DDLElement` - The root of all DDL expressions,
+  like CREATE TABLE, ALTER TABLE, etc. Compilation of :class:`.DDLElement`
+  subclasses is issued by a :class:`.DDLCompiler` instead of a
+  :class:`.SQLCompiler`. :class:`.DDLElement` can also be used as an event hook
+  in conjunction with event hooks like :meth:`.DDLEvents.before_create` and
+  :meth:`.DDLEvents.after_create`, allowing the construct to be invoked
+  automatically during CREATE TABLE and DROP TABLE sequences.
+
+  .. seealso::
+
+    :ref:`metadata_ddl_toplevel` - contains examples of associating
+    :class:`.DDL` objects (which are themselves :class:`.DDLElement`
+    instances) with :class:`.DDLEvents` event hooks.
 
 * :class:`~sqlalchemy.sql.expression.Executable` - This is a mixin which
   should be used with any expression class that represents a "standalone"
index 4d57ad869810a3a59bf09959e33d6ea03ebc00d8..131ae9ef1120a33b0ee3c5761ae5001563f21b20 100644 (file)
@@ -345,8 +345,10 @@ class DDL(DDLElement):
 
         :param statement:
           A string or unicode string to be executed.  Statements will be
-          processed with Python's string formatting operator.  See the
-          ``context`` argument and the ``execute_at`` method.
+          processed with Python's string formatting operator using
+          a fixed set of string substitutions, as well as additional
+          substitutions provided by the optional :paramref:`.DDL.context`
+          parameter.
 
           A literal '%' in a statement must be escaped as '%%'.