Commits

Mike Bayer  committed c339d8a

- some more interpret_as_froms

  • Participants
  • Parent commits 8c06387

Comments (0)

Files changed (3)

File lib/sqlalchemy/sql/expression.py

         :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)
 
         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()

File test/aaa_profiling/test_resultset.py

                                     '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()]
 
     @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()]
 
         # 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")
         # 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")

File test/orm/test_query.py

             "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")
             "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