diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-09-24 19:27:52 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-09-24 19:27:52 +0000 |
| commit | a0838e0c476f7deab5b67f431c8ce107974b9313 (patch) | |
| tree | 5a990b0a2f87f142bf96c75fa7c2597198f887f7 /test/sql/query.py | |
| parent | 6b5543995b66b524097ad540a0a3f9dfd9eb9413 (diff) | |
| download | sqlalchemy-a0838e0c476f7deab5b67f431c8ce107974b9313.tar.gz | |
- columns from Alias objects, when used to target result-row columns, must match exactly
to the label used in the generated statement. This is so searching for columns in a
result row which match aliases won't accidentally match non-aliased columns.
fixes errors which can arise in eager loading scenarios.
Diffstat (limited to 'test/sql/query.py')
| -rw-r--r-- | test/sql/query.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/sql/query.py b/test/sql/query.py index a519dd974..e64425e91 100644 --- a/test/sql/query.py +++ b/test/sql/query.py @@ -429,6 +429,22 @@ class QueryTest(PersistTest): self.assertEqual([x.lower() for x in r.keys()], ['user_name', 'user_id']) self.assertEqual(r.values(), ['foo', 1]) + def test_exact_match(self): + """test that an Alias object only targets result columns that were generated + from that Alias. This is also part of eager_relations.py/test_no_false_hits. + """ + + users.insert().execute(user_id=1, user_name='ed') + users_alias = users.alias() + result = users.select().execute() + row = result.fetchone() + assert users_alias.c.user_id not in row + + result = users_alias.select().execute() + row = result.fetchone() + assert users_alias.c.user_id in row + + @testing.unsupported('oracle', 'firebird') def test_column_accessor_shadow(self): meta = MetaData(testbase.db) |
