diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-11-19 23:28:01 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-11-19 23:28:01 -0500 |
| commit | c0c42af4e0ef8acd651cc66e84ec636c14ab53a5 (patch) | |
| tree | 51e30c32ccde9f3498af2018e5a65084e208556b /test/sql/test_selectable.py | |
| parent | 25f77454bdbfbe994eeb92a9824f135a603a0776 (diff) | |
| download | sqlalchemy-c0c42af4e0ef8acd651cc66e84ec636c14ab53a5.tar.gz | |
- [bug] further tweak to the fix from [ticket:2261],
so that generative methods work a bit better
off of cloned (this is almost a non-use case though).
In particular this allows with_only_columns()
to behave more consistently. Added additional
documentation to with_only_columns() to clarify
expected behavior, which changed as a result
of [ticket:2261]. [ticket:2319]
- document the crap out of with_only_columns, include caveats about
the change, etc.
Diffstat (limited to 'test/sql/test_selectable.py')
| -rw-r--r-- | test/sql/test_selectable.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py index 9a9fc0de9..e9596b1ae 100644 --- a/test/sql/test_selectable.py +++ b/test/sql/test_selectable.py @@ -446,6 +446,27 @@ class SelectableTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiled Table, 't', MetaData(), c1 ) + def test_from_list_with_columns(self): + table1 = table('t1', column('a')) + table2 = table('t2', column('b')) + s1 = select([table1.c.a, table2.c.b]) + self.assert_compile(s1, + "SELECT t1.a, t2.b FROM t1, t2" + ) + s2 = s1.with_only_columns([table2.c.b]) + self.assert_compile(s2, + "SELECT t2.b FROM t2" + ) + + s3 = sql_util.ClauseAdapter(table1).traverse(s1) + self.assert_compile(s3, + "SELECT t1.a, t2.b FROM t1, t2" + ) + s4 = s3.with_only_columns([table2.c.b]) + self.assert_compile(s4, + "SELECT t2.b FROM t2" + ) + def test_from_list_warning_against_existing(self): c1 = Column('c1', Integer) s = select([c1]) |
