summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-01-27 15:07:17 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-03-25 10:16:36 -0400
commit57877461c1bd3b43a9d833fbca873d59db36b6f7 (patch)
treee6fa8a914f8275ee2a7b99b4772cff14438c6b7f /lib/sqlalchemy/sql/compiler.py
parent6f02d5edd88fe2475629438b0730181a2b00c5fe (diff)
downloadsqlalchemy-57877461c1bd3b43a9d833fbca873d59db36b6f7.tar.gz
generalize conditional DDL throughout schema / DDL
Expanded on the "conditional DDL" system implemented by the :class:`_schema.DDLElement` class to be directly available on :class:`_schema.SchemaItem` constructs such as :class:`_schema.Index`, :class:`_schema.ForeignKeyConstraint`, etc. such that the conditional logic for generating these elements is included within the default DDL emitting process. This system can also be accommodated by a future release of Alembic to support conditional DDL elements within all schema-management systems. Fixes: #7631 Change-Id: I9457524d7f66f49696187cf7d2b37dbb44f0e20b
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 5ba52ae51..aa98ff256 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -4889,10 +4889,7 @@ class DDLCompiler(Compiled):
for p in (
self.process(constraint)
for constraint in constraints
- if (
- constraint._create_rule is None
- or constraint._create_rule(self)
- )
+ if (constraint._should_create_for_compiler(self))
and (
not self.dialect.supports_alter
or not getattr(constraint, "use_alter", False)