From: Mike Bayer Date: Sat, 12 Sep 2009 23:53:03 +0000 (+0000) Subject: - some ordering fixes on DISTINCT for PG 8.4, mysql X-Git-Tag: rel_0_5_6 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=654d245c91c9eae6d5dd80bce4f20f90c358a51e;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - some ordering fixes on DISTINCT for PG 8.4, mysql - forwards compat "postgresql" name available for --db, engine urls --- diff --git a/CHANGES b/CHANGES index d19085c00f..79d08eb90b 100644 --- a/CHANGES +++ b/CHANGES @@ -113,6 +113,10 @@ CHANGES 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] diff --git a/lib/sqlalchemy/databases/postgresql.py b/lib/sqlalchemy/databases/postgresql.py new file mode 100644 index 0000000000..0b7a4323d3 --- /dev/null +++ b/lib/sqlalchemy/databases/postgresql.py @@ -0,0 +1,5 @@ +"""Provide forwards compatibility with SQLAlchemy 0.6 which +uses the name "postgresql" for the Postgresql dialect. + +""" +from sqlalchemy.databases.postgres import dialect \ No newline at end of file diff --git a/lib/sqlalchemy/test/config.py b/lib/sqlalchemy/test/config.py index 6ea5667cc3..5b2171dc23 100644 --- a/lib/sqlalchemy/test/config.py +++ b/lib/sqlalchemy/test/config.py @@ -14,6 +14,7 @@ base_config = """ 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 diff --git a/test/orm/test_eager_relations.py b/test/orm/test_eager_relations.py index 384e0472f6..aaba9bbe5d 100644 --- a/test/orm/test_eager_relations.py +++ b/test/orm/test_eager_relations.py @@ -483,15 +483,15 @@ class EagerTest(_fixtures.FixtureTest): 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') diff --git a/test/orm/test_lazy_relations.py b/test/orm/test_lazy_relations.py index 819f29911e..8867232b24 100644 --- a/test/orm/test_lazy_relations.py +++ b/test/orm/test_lazy_relations.py @@ -164,8 +164,8 @@ class LazyTest(_fixtures.FixtureTest): 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): diff --git a/test/orm/test_query.py b/test/orm/test_query.py index 09e27c8d89..1934a1330f 100644 --- a/test/orm/test_query.py +++ b/test/orm/test_query.py @@ -987,7 +987,7 @@ class CountTest(QueryTest): 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):