summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/elements.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-01-09 22:17:59 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2018-01-12 13:01:26 -0500
commit7402987fd218c42ed2a909a5031186d2b702bb88 (patch)
treea418897eb557bbdad09878aa7dcc2e2aab7dfb3a /lib/sqlalchemy/sql/elements.py
parent127ead7452f326509cde38fcf7c9f38f69d9ae0a (diff)
downloadsqlalchemy-7402987fd218c42ed2a909a5031186d2b702bb88.tar.gz
Make column-level collation quoting dialect-specific
Fixed regression in 1.2 where newly repaired quoting of collation names in :ticket:`3785` breaks SQL Server, which explicitly does not understand a quoted collation name. Whether or not mixed-case collation names are quoted or not is now deferred down to a dialect-level decision so that each dialect can prepare these identifiers directly. Change-Id: Iaf0a8123d9bf4711219e320896bb28c5d2649304 Fixes: #4154
Diffstat (limited to 'lib/sqlalchemy/sql/elements.py')
-rw-r--r--lib/sqlalchemy/sql/elements.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py
index 2cc1d9c42..fd2c9c0bd 100644
--- a/lib/sqlalchemy/sql/elements.py
+++ b/lib/sqlalchemy/sql/elements.py
@@ -52,7 +52,7 @@ def collate(expression, collation):
expr = _literal_as_binds(expression)
return BinaryExpression(
expr,
- ColumnClause(collation),
+ CollationClause(collation),
operators.collate, type_=expr.type)
@@ -3873,6 +3873,13 @@ class ColumnClause(Immutable, ColumnElement):
return c
+class CollationClause(ColumnElement):
+ __visit_name__ = "collation"
+
+ def __init__(self, collation):
+ self.collation = collation
+
+
class _IdentifiedClause(Executable, ClauseElement):
__visit_name__ = 'identified'