mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-05-27 11:01:44 -04:00
- some more interpret_as_froms
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user