Commits

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.
       [ticket:1482]
 
+- 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]

lib/sqlalchemy/databases/postgresql.py

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

lib/sqlalchemy/test/config.py

 sqlite=sqlite:///:memory:
 sqlite_file=sqlite:///querytest.db
 postgres=postgres://scott:tiger@127.0.0.1:5432/test
+postgresql=postgres://scott:tiger@127.0.0.1:5432/test
 mysql=mysql://scott:tiger@127.0.0.1:3306/test
 oracle=oracle://scott:tiger@127.0.0.1:1521
 oracle8=oracle://scott:tiger@127.0.0.1:1521/?use_ansi=0

test/orm/test_eager_relations.py

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

test/orm/test_lazy_relations.py

         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)
 
     @testing.resolve_artifact_names
     def test_one_to_many_scalar(self):

test/orm/test_query.py

         
 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.