From 133a0b2460f4c71692795ebbe52f9e521bb8782c Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 4 Dec 2011 13:46:45 -0500 Subject: - [bug] the "name" of a column-level CHECK constraint, if present, is now rendered in the CREATE TABLE statement using "CONSTRAINT CHECK ". [ticket:2305] --- lib/sqlalchemy/sql/compiler.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql') 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 -- cgit v1.2.1