summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-03-19 01:18:06 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2021-03-19 01:19:32 -0400
commite67d1b79c544c14f375dff90b5d8af5b472c053e (patch)
tree177d6959aaf1560e8a4cadc81fe8117c5ee27636 /test/sql
parentd0812a1abf903f6b5f1a0bfb19f8c87a665f8309 (diff)
downloadsqlalchemy-e67d1b79c544c14f375dff90b5d8af5b472c053e.tar.gz
Deannoate functions before matching .__class__
Fixed regression where the SQL compilation of a :class:`.Function` would not work correctly if the object had been "annotated", which is an internal memoization process used mostly by the ORM. In particular it could affect ORM lazy loads which make greater use of this feature in 1.4. Fixes: #6095 Change-Id: I7a6527df651f440a04d911ba78ee0b0dd4436dcd
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/test_functions.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/sql/test_functions.py b/test/sql/test_functions.py
index 96e0a9129..c5aca5d7f 100644
--- a/test/sql/test_functions.py
+++ b/test/sql/test_functions.py
@@ -256,6 +256,13 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
fn = func.coalesce("x", "y")._annotate({"foo": "bar"})
self.assert_compile(fn, "coalesce(:coalesce_1, :coalesce_2)")
+ def test_annotation_dialect_specific(self):
+ fn = func.current_date()
+ self.assert_compile(fn, "CURRENT_DATE", dialect="sqlite")
+
+ fn = fn._annotate({"foo": "bar"})
+ self.assert_compile(fn, "CURRENT_DATE", dialect="sqlite")
+
def test_custom_default_namespace(self):
class myfunc(GenericFunction):
pass