diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-11-03 23:17:34 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-11-03 23:17:34 +0000 |
| commit | 8ebc8ee5bae0f4bef465e8b5b4b46609cfdebc10 (patch) | |
| tree | c27fc44d024fa066c6ea8af752305ccb506e7019 /test/sql | |
| parent | 0af3f8f35b5e46f749d328e6fae90f6ff4915e97 (diff) | |
| download | sqlalchemy-8ebc8ee5bae0f4bef465e8b5b4b46609cfdebc10.tar.gz | |
- eager loading with LIMIT/OFFSET applied no longer adds the primary
table joined to a limited subquery of itself; the eager loads now
join directly to the subquery which also provides the primary table's
columns to the result set. This eliminates a JOIN from all eager loads
with LIMIT/OFFSET. [ticket:843]
Diffstat (limited to 'test/sql')
| -rwxr-xr-x | test/sql/selectable.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/sql/selectable.py b/test/sql/selectable.py index 72f5f35d0..9fca3ee08 100755 --- a/test/sql/selectable.py +++ b/test/sql/selectable.py @@ -166,7 +166,27 @@ class SelectableTest(AssertMixin): print str(criterion) print str(j.onclause) self.assert_(criterion.compare(j.onclause)) - + + def testtablejoinedtoselectoftable(self): + metadata = MetaData() + a = Table('a', metadata, + Column('id', Integer, primary_key=True)) + b = Table('b', metadata, + Column('id', Integer, primary_key=True), + Column('aid', Integer, ForeignKey('a.id')), + ) + + j1 = a.outerjoin(b) + j2 = select([a.c.id.label('aid')]).alias('bar') + + j3 = a.join(j2, j2.c.aid==a.c.id) + + j4 = select([j3]).alias('foo') + print j4 + print j4.corresponding_column(j2.c.aid) + print j4.c.aid + # TODO: this is the assertion case which fails +# assert j4.corresponding_column(j2.c.aid) is j4.c.aid class PrimaryKeyTest(AssertMixin): def test_join_pk_collapse_implicit(self): |
