summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/elements.py7
-rw-r--r--lib/sqlalchemy/sql/selectable.py6
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py
index 975cf2d79..cca03851f 100644
--- a/lib/sqlalchemy/sql/elements.py
+++ b/lib/sqlalchemy/sql/elements.py
@@ -2920,9 +2920,12 @@ class ColumnClause(Immutable, ColumnElement):
def _compare_name_for_result(self, other):
if self.is_literal or \
- self.table is None or \
+ self.table is None or self.table._textual or \
not hasattr(other, 'proxy_set') or (
- isinstance(other, ColumnClause) and other.is_literal
+ isinstance(other, ColumnClause) and
+ (other.is_literal or
+ other.table is None or
+ other.table._textual)
):
return super(ColumnClause, self).\
_compare_name_for_result(other)
diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py
index 01d617259..bda3d655e 100644
--- a/lib/sqlalchemy/sql/selectable.py
+++ b/lib/sqlalchemy/sql/selectable.py
@@ -137,6 +137,10 @@ class FromClause(Selectable):
named_with_column = False
_hide_froms = []
+ _textual = False
+ """a marker that allows us to easily distinguish a :class:`.TextAsFrom`
+ or similar object from other kinds of :class:`.FromClause` objects."""
+
schema = None
"""Define the 'schema' attribute for this :class:`.FromClause`.
@@ -3046,6 +3050,8 @@ class TextAsFrom(SelectBase):
"""
__visit_name__ = "text_as_from"
+ _textual = True
+
def __init__(self, text, columns):
self.element = text
self.column_args = columns