summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2021-03-19 05:23:26 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2021-03-19 05:23:26 +0000
commitaabb899ea5adb437b7a9ee45edf2d492ae2a5980 (patch)
treefc62aa8abd4b4ad83bf8ffd62d8a1a2424199496 /lib/sqlalchemy
parentffbced86711812a5cb16038092d3e181f92a1eab (diff)
parentc1c999c01d595b74fe178d9bdbff34fd8939a283 (diff)
downloadsqlalchemy-aabb899ea5adb437b7a9ee45edf2d492ae2a5980.tar.gz
Merge "Ensure ClauseAdapter treats FunctionElement as a ColumnElement"
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/context.py2
-rw-r--r--lib/sqlalchemy/sql/util.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/context.py b/lib/sqlalchemy/orm/context.py
index 45ab64593..b0b8faee7 100644
--- a/lib/sqlalchemy/orm/context.py
+++ b/lib/sqlalchemy/orm/context.py
@@ -2707,7 +2707,9 @@ class _ORMColumnEntity(_ColumnEntity):
compile_state._entities.append(self)
compile_state._has_orm_entities = True
+
self.column = column
+
self._fetch_column = self._row_processor = None
self._extra_entities = (self.expr, self.column)
diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py
index 5f35de5f0..4300d8a29 100644
--- a/lib/sqlalchemy/sql/util.py
+++ b/lib/sqlalchemy/sql/util.py
@@ -843,8 +843,13 @@ class ClauseAdapter(visitors.ReplacingExternalTraversal):
newcol = self.selectable.exported_columns.get(col.name)
return newcol
+ @util.preload_module("sqlalchemy.sql.functions")
def replace(self, col):
- if isinstance(col, FromClause):
+ functions = util.preloaded.sql_functions
+
+ if isinstance(col, FromClause) and not isinstance(
+ col, functions.FunctionElement
+ ):
if self.selectable.is_derived_from(col):
return self.selectable
elif isinstance(col, Alias) and isinstance(