summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-01-06 14:09:01 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2020-01-06 14:11:18 -0500
commita697fcc1cb87b5a4e4f0c70361bd598086f4210f (patch)
tree7ca1b9fa64008d99ebde1d1170fb322b4bff68ea /lib/sqlalchemy/sql/compiler.py
parentd9dda8b94036dd5c76968f3ca0d3400f5d765894 (diff)
downloadsqlalchemy-a697fcc1cb87b5a4e4f0c70361bd598086f4210f.tar.gz
Support GenericFunction.name passed as a quoted_name
A function created using :class:`.GenericFunction` can now specify that the name of the function should be rendered with or without quotes by assigning the :class:`.quoted_name` construct to the .name element of the object. Prior to 1.3.4, quoting was never applied to function names, and some quoting was introduced in :ticket:`4467` but no means to force quoting for a mixed case name was available. Additionally, the :class:`.quoted_name` construct when used as the name will properly register its lowercase name in the function registry so that the name continues to be available via the ``func.`` registry. Fixes: #5079 Change-Id: I0653ab8b16e75e628ce82dbbc3d0f77f8336c407
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 5333b1419..8499484f3 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -1329,6 +1329,7 @@ class SQLCompiler(Compiled):
name = (
self.preparer.quote(name)
if self.preparer._requires_quotes_illegal_chars(name)
+ or isinstance(name, elements.quoted_name)
else name
)
name = name + "%(expr)s"
@@ -1337,6 +1338,7 @@ class SQLCompiler(Compiled):
(
self.preparer.quote(tok)
if self.preparer._requires_quotes_illegal_chars(tok)
+ or isinstance(name, elements.quoted_name)
else tok
)
for tok in func.packagenames