diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-09-05 16:44:42 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-09-05 16:44:42 -0400 |
| commit | 7b766591b05ceeb9c47588d6326a6be56a230594 (patch) | |
| tree | fe0e35edbf3332a1c43428add875691d3b86ab4b /lib/sqlalchemy/dialects/mysql/base.py | |
| parent | 583287259fbb6d143696b418756ed68e6110cd2d (diff) | |
| download | sqlalchemy-7b766591b05ceeb9c47588d6326a6be56a230594.tar.gz | |
- MySQL boolean symbols "true", "false" work again. 0.9's change
in :ticket:`2682` disallowed the MySQL dialect from making use of the
"true" and "false" symbols in the context of "IS" / "IS NOT", but
MySQL supports this syntax even though it has no boolean type.
MySQL remains "non native boolean", but the :func:`.true`
and :func:`.false` symbols again produce the
keywords "true" and "false", so that an expression like
``column.is_(true())`` again works on MySQL.
fixes #3186
Diffstat (limited to 'lib/sqlalchemy/dialects/mysql/base.py')
| -rw-r--r-- | lib/sqlalchemy/dialects/mysql/base.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py index 4dccd2760..247b7a143 100644 --- a/lib/sqlalchemy/dialects/mysql/base.py +++ b/lib/sqlalchemy/dialects/mysql/base.py @@ -1637,6 +1637,14 @@ class MySQLCompiler(compiler.SQLCompiler): value = value.replace('\\', '\\\\') return value + # override native_boolean=False behavior here, as + # MySQL still supports native boolean + def visit_true(self, element, **kw): + return "true" + + def visit_false(self, element, **kw): + return "false" + def get_select_precolumns(self, select): """Add special MySQL keywords in place of DISTINCT. @@ -2215,6 +2223,10 @@ class MySQLDialect(default.DefaultDialect): name = 'mysql' supports_alter = True + # MySQL has no true "boolean" type; we + # allow for the "true" and "false" keywords, however + supports_native_boolean = False + # identifiers are 64, however aliases can be 255... max_identifier_length = 255 max_index_name_length = 64 |
