diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-12-04 13:46:45 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-12-04 13:46:45 -0500 |
commit | 133a0b2460f4c71692795ebbe52f9e521bb8782c (patch) | |
tree | ce469b81e8b4f1553ea83ee3c091797e227640f6 /lib/sqlalchemy/sql/compiler.py | |
parent | 3867ea9dc7b432f84d29496c1824486b14cd8bfa (diff) | |
download | sqlalchemy-133a0b2460f4c71692795ebbe52f9e521bb8782c.tar.gz |
- [bug] the "name" of a column-level CHECK constraint,
if present, is now rendered in the CREATE TABLE
statement using "CONSTRAINT <name> CHECK <expression>".
[ticket:2305]
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 7aee5da81..f49c0d1e9 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -1511,7 +1511,11 @@ class DDLCompiler(engine.Compiled): return text def visit_column_check_constraint(self, constraint): - text = "CHECK (%s)" % constraint.sqltext + text = "" + if constraint.name is not None: + text += "CONSTRAINT %s " % \ + self.preparer.format_constraint(constraint) + text += "CHECK (%s)" % constraint.sqltext text += self.define_constraint_deferrability(constraint) return text |