summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/naming.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-01-30 13:38:51 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2015-01-30 13:38:51 -0500
commit383bb3f708168aedb1832050a84ff054f8211386 (patch)
tree3bc8837150ab66a2be63c780ac5912f5cb89e5bc /lib/sqlalchemy/sql/naming.py
parent3712e35c329cc3b5106f026be90e04f65412586d (diff)
downloadsqlalchemy-383bb3f708168aedb1832050a84ff054f8211386.tar.gz
- The :class:`.CheckConstraint` construct now supports naming
conventions that include the token ``%(column_0_name)s``; the constraint expression is scanned for columns. Additionally, naming conventions for check constraints that don't include the ``%(constraint_name)s`` token will now work for :class:`.SchemaType`- generated constraints, such as those of :class:`.Boolean` and :class:`.Enum`; this stopped working in 0.9.7 due to :ticket:`3067`. fixes #3299
Diffstat (limited to 'lib/sqlalchemy/sql/naming.py')
-rw-r--r--lib/sqlalchemy/sql/naming.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/sqlalchemy/sql/naming.py b/lib/sqlalchemy/sql/naming.py
index 9e57418b0..6508ed620 100644
--- a/lib/sqlalchemy/sql/naming.py
+++ b/lib/sqlalchemy/sql/naming.py
@@ -113,10 +113,12 @@ def _constraint_name_for_table(const, table):
if isinstance(const.name, conv):
return const.name
- elif convention is not None and (
- const.name is None or not isinstance(const.name, conv) and
- "constraint_name" in convention
- ):
+ elif convention is not None and \
+ not isinstance(const.name, conv) and \
+ (
+ const.name is None or
+ "constraint_name" in convention or
+ isinstance(const.name, _defer_name)):
return conv(
convention % ConventionDict(const, table,
metadata.naming_convention)