diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-12-16 19:32:10 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-12-16 19:32:10 -0500 |
| commit | 207aaf2f41cff5970b34999d3cfc845a3b0df29c (patch) | |
| tree | ae5c7eb814efcb3a00b0d34e60295f9c045403c6 /lib/sqlalchemy/sql/schema.py | |
| parent | 84f1d3417978197c695850b3711ea4b7e2582be8 (diff) | |
| download | sqlalchemy-207aaf2f41cff5970b34999d3cfc845a3b0df29c.tar.gz | |
- for [ticket:2651], leaving CheckConstraint alone, preferring to keep
backwards compatibility. A note about backslashing escapes is added.
Because the Text() construct now supports bind params better, the example
given in the code raises an exception now, so that should cover us.
The exception itself has been enhanced to include the key name of the
bound param. We're backporting this to 0.8 but 0.8 doesn't have the
text->bind behavior that raises.
Diffstat (limited to 'lib/sqlalchemy/sql/schema.py')
| -rw-r--r-- | lib/sqlalchemy/sql/schema.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index 4d9dc2bda..6205ada34 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -2272,7 +2272,11 @@ class CheckConstraint(Constraint): :param sqltext: A string containing the constraint definition, which will be used - verbatim, or a SQL expression construct. + verbatim, or a SQL expression construct. If given as a string, + the object is converted to a :class:`.Text` object. If the textual + string includes a colon character, escape this using a backslash:: + + CheckConstraint(r"foo ~ E'a(?\:b|c)d") :param name: Optional, the in-database name of the constraint. |
