summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/sqlalchemy/sql/expression.py6
-rw-r--r--test/aaa_profiling/test_resultset.py16
-rw-r--r--test/orm/test_query.py18
3 files changed, 29 insertions, 11 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py
index a518852d8..a26a71f16 100644
--- a/lib/sqlalchemy/sql/expression.py
+++ b/lib/sqlalchemy/sql/expression.py
@@ -3665,8 +3665,8 @@ class Join(FromClause):
:class:`.FromClause` object.
"""
- self.left = _literal_as_text(left)
- self.right = _literal_as_text(right).self_group()
+ self.left = _interpret_as_from(left)
+ self.right = _interpret_as_from(right).self_group()
if onclause is None:
self.onclause = self._match_primaries(self.left, self.right)
@@ -4886,7 +4886,7 @@ class Select(SelectBase):
if from_obj is not None:
self._from_obj = util.OrderedSet(
- _literal_as_text(f)
+ _interpret_as_from(f)
for f in util.to_list(from_obj))
else:
self._from_obj = util.OrderedSet()
diff --git a/test/aaa_profiling/test_resultset.py b/test/aaa_profiling/test_resultset.py
index bb16ea124..f6687f3dd 100644
--- a/test/aaa_profiling/test_resultset.py
+++ b/test/aaa_profiling/test_resultset.py
@@ -38,8 +38,8 @@ class ResultSetTest(fixtures.TestBase, AssertsExecutionResults):
'2.4': 13214,
'2.6':14416,
'2.7':14416,
- '2.6+cextension': 336,
- '2.7+cextension':336})
+ '2.6+cextension': 354,
+ '2.7+cextension':354})
def test_string(self):
[tuple(row) for row in t.select().execute().fetchall()]
@@ -48,8 +48,8 @@ class ResultSetTest(fixtures.TestBase, AssertsExecutionResults):
@profiling.function_call_count(versions={
'2.7':14396,
'2.6':14396,
- '2.6+cextension': 336,
- '2.7+cextension':336})
+ '2.6+cextension': 354,
+ '2.7+cextension':354})
def test_unicode(self):
[tuple(row) for row in t2.select().execute().fetchall()]
@@ -72,8 +72,8 @@ class ExecutionTest(fixtures.TestBase):
# ensure initial connect activities complete
c.execute("select 1")
- @profiling.function_call_count(versions={'2.7':40, '2.6':40, '2.5':35,
- '2.4':21, '3':40},
+ @profiling.function_call_count(versions={'2.7':40, '2.6':40, '2.5':35,
+ '2.4':21, '3':40},
variance=.10)
def go():
c.execute("select 1")
@@ -85,10 +85,10 @@ class ExecutionTest(fixtures.TestBase):
# ensure initial connect activities complete
e.execute("select 1")
- @profiling.function_call_count(versions={'2.4':41, '2.5':65,
+ @profiling.function_call_count(versions={'2.4':41, '2.5':65,
'2.6':65, '3':61,
'2.7':65,
- '2.6+cextension':65},
+ '2.6+cextension':65},
variance=.05)
def go():
e.execute("select 1")
diff --git a/test/orm/test_query.py b/test/orm/test_query.py
index b80db67eb..44e016c86 100644
--- a/test/orm/test_query.py
+++ b/test/orm/test_query.py
@@ -130,6 +130,14 @@ class RawSelectTest(QueryTest, AssertsCompiledSQL):
"SELECT * FROM users"
)
+ def test_inline_select_from_entity(self):
+ User = self.classes.User
+
+ self.assert_compile(
+ select(['*'], from_obj=User),
+ "SELECT * FROM users"
+ )
+
def test_select_from_aliased_entity(self):
User = self.classes.User
ua = aliased(User, name="ua")
@@ -193,6 +201,16 @@ class RawSelectTest(QueryTest, AssertsCompiledSQL):
"SELECT ua.id, ua.name FROM users AS ua"
)
+ def test_core_join(self):
+ User = self.classes.User
+ Address = self.classes.Address
+ from sqlalchemy.sql import join
+ self.assert_compile(
+ select([User]).select_from(join(User, Address)),
+ "SELECT users.id, users.name FROM users "
+ "JOIN addresses ON users.id = addresses.user_id"
+ )
+
class GetTest(QueryTest):
def test_get(self):
User = self.classes.User