class HasConditionalDDL: (source)
Known subclasses: sqlalchemy.sql.schema.Constraint
, sqlalchemy.sql.schema.Index
define a class that includes the :meth:`.HasConditionalDDL.ddl_if` method, allowing for conditional rendering of DDL. Currently applies to constraints and indexes. .. versionadded:: 2.0
Method | ddl |
apply a conditional DDL rule to this schema item. |
Instance Variable | _ddl |
Undocumented |
Optional[ str]
= None, callable_: Optional[ ddl.DDLIfCallable]
= None, state: Optional[ Any]
= None) -> Self
:
(source)
¶
apply a conditional DDL rule to this schema item. These rules work in a similar manner to the :meth:`.ExecutableDDLElement.execute_if` callable, with the added feature that the criteria may be checked within the DDL compilation phase for a construct such as :class:`.CreateTable`. :meth:`.HasConditionalDDL.ddl_if` currently applies towards the :class:`.Index` construct as well as all :class:`.Constraint` constructs. :param dialect: string name of a dialect, or a tuple of string names to indicate multiple dialect types. :param callable\_: a callable that is constructed using the same form as that described in :paramref:`.ExecutableDDLElement.execute_if.callable_`. :param state: any arbitrary object that will be passed to the callable, if present. .. versionadded:: 2.0 .. seealso:: :ref:`schema_ddl_ddl_if` - background and usage examples