From 830125d0ed397f6785d2618b82abd61bf0a36761 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 23 Oct 2011 12:00:31 -0400 Subject: [PATCH] - Cls.column.collate("some collation") now works. [ticket:1776] --- CHANGES | 3 +++ lib/sqlalchemy/sql/operators.py | 12 ++++++------ test/orm/test_query.py | 7 +++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 7cb3694e9b..742a32eae7 100644 --- a/CHANGES +++ b/CHANGES @@ -61,6 +61,9 @@ CHANGES after from_statement() were called. [ticket:2199]. + - Cls.column.collate("some collation") now + works. [ticket:1776] + - sql - Fixed two subtle bugs involving column correspondence in a selectable, diff --git a/lib/sqlalchemy/sql/operators.py b/lib/sqlalchemy/sql/operators.py index a85b38f266..68deb96981 100644 --- a/lib/sqlalchemy/sql/operators.py +++ b/lib/sqlalchemy/sql/operators.py @@ -29,14 +29,14 @@ def as_(): def exists(): raise NotImplementedError() -def is_(): - raise NotImplementedError() +def is_(a, b): + return a.is_(b) -def isnot(): - raise NotImplementedError() +def isnot(a, b): + return a.isnot(b) -def collate(): - raise NotImplementedError() +def collate(a, b): + return a.collate(b) def op(a, opstring, b): return a.op(opstring)(b) diff --git a/test/orm/test_query.py b/test/orm/test_query.py index 9c89b837b9..873cd42b42 100644 --- a/test/orm/test_query.py +++ b/test/orm/test_query.py @@ -619,6 +619,13 @@ class OperatorTest(QueryTest, AssertsCompiledSQL): self._test(User.id.between('a', 'b'), "users.id BETWEEN :id_1 AND :id_2") + def test_collate(self): + self._test(collate(User.id, 'binary'), + "users.id COLLATE binary") + + self._test(User.id.collate('binary'), + "users.id COLLATE binary") + def test_selfref_between(self): ualias = aliased(User) self._test(User.id.between(ualias.id, ualias.id), "users.id BETWEEN users_1.id AND users_1.id") -- 2.47.3