Mike Bayer avatar Mike Bayer committed 63f33c5

- some ordering fixes on DISTINCT for PG 8.4, mysql
- forwards compat "postgresql" name available for --db, engine urls

Comments (0)

Files changed (6)

       dict for "info" argument would raise an exception.
+- postgresql
+    - The driver can be specified as "postgresql://" in URLs,
+      allowing forwards-compatibility with 0.6.
 - oracle
     - Backported 0.6 fix for Oracle alias names not getting
       truncated.  [ticket:1309]


+"""Provide forwards compatibility with SQLAlchemy 0.6 which 
+uses the name "postgresql" for the Postgresql dialect.
+from sqlalchemy.databases.postgres import dialect




         s = sa.union_all(u2.select(use_labels=True), u2.select(use_labels=True), u2.select(use_labels=True)).alias('u')
         mapper(User, users, properties={
-            'addresses':relation(mapper(Address, addresses), lazy=False),
+            'addresses':relation(mapper(Address, addresses), lazy=False, order_by=addresses.c.id),
         sess = create_session()
         q = sess.query(User)
         def go():
-            l = q.filter(s.c.u2_id==User.id).distinct().all()
-            assert self.static.user_address_result == l
+            l = q.filter(s.c.u2_id==User.id).distinct().order_by(User.id).all()
+            eq_(self.static.user_address_result, l)
         self.assert_sql_count(testing.db, go, 1)
     @testing.fails_on('maxdb', 'FIXME: unknown')


         u2 = users.alias('u2')
         s = sa.union_all(u2.select(use_labels=True), u2.select(use_labels=True), u2.select(use_labels=True)).alias('u')
         print [key for key in s.c.keys()]
-        l = q.filter(s.c.u2_id==User.id).distinct().all()
-        assert self.static.user_all_result == l
+        l = q.filter(s.c.u2_id==User.id).distinct().order_by(User.id).all()
+        eq_(self.static.user_all_result, l)
     def test_one_to_many_scalar(self):


 class DistinctTest(QueryTest):
     def test_basic(self):
-        assert [User(id=7), User(id=8), User(id=9),User(id=10)] == create_session().query(User).distinct().all()
+        assert [User(id=7), User(id=8), User(id=9),User(id=10)] == create_session().query(User).distinct().order_by(User.id).all()
         assert [User(id=7), User(id=9), User(id=8),User(id=10)] == create_session().query(User).distinct().order_by(desc(User.name)).all()
     def test_joined(self):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.