summaryrefslogtreecommitdiff
path: root/test/sql/test_query.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-02-02 11:06:08 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2014-02-02 11:06:08 -0500
commit29de1077b35fb264f4b1727bd1f4987644ff52b7 (patch)
treebe0c3283a6447f316fcf44b6c1945bead922ec89 /test/sql/test_query.py
parent5b0919f3f5c7678c587858a47e38acd4a5b82f25 (diff)
downloadsqlalchemy-29de1077b35fb264f4b1727bd1f4987644ff52b7.tar.gz
- Fixed bug in new :class:`.TextAsFrom` construct where :class:`.Column`-
oriented row lookups were not matching up to the ad-hoc :class:`.ColumnClause` objects that :class:`.TextAsFrom` generates, thereby making it not usable as a target in :meth:`.Query.from_statement`. Also fixed :meth:`.Query.from_statement` mechanics to not mistake a :class:`.TextAsFrom` for a :class:`.Select` construct. This bug is also an 0.9 regression as the :meth:`.Text.columns` method is called to accommodate the :paramref:`.text.typemap` argument. [ticket:2932]
Diffstat (limited to 'test/sql/test_query.py')
-rw-r--r--test/sql/test_query.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/sql/test_query.py b/test/sql/test_query.py
index 26e2fcf34..6e2227650 100644
--- a/test/sql/test_query.py
+++ b/test/sql/test_query.py
@@ -1787,6 +1787,51 @@ class KeyTargetingTest(fixtures.TablesTest):
assert bar.c.content_type not in row
assert sql.column('content_type') not in row
+ def test_columnclause_schema_column_one(self):
+ keyed2 = self.tables.keyed2
+
+ # this is addressed by [ticket:2932]
+ # ColumnClause._compare_name_for_result allows the
+ # columns which the statement is against to be lightweight
+ # cols, which results in a more liberal comparison scheme
+ a, b = sql.column('a'), sql.column('b')
+ stmt = select([a, b]).select_from("keyed2")
+ row = testing.db.execute(stmt).first()
+
+ assert keyed2.c.a in row
+ assert keyed2.c.b in row
+ assert a in row
+ assert b in row
+
+ def test_columnclause_schema_column_two(self):
+ keyed2 = self.tables.keyed2
+
+ a, b = sql.column('a'), sql.column('b')
+ stmt = select([keyed2.c.a, keyed2.c.b])
+ row = testing.db.execute(stmt).first()
+
+ assert keyed2.c.a in row
+ assert keyed2.c.b in row
+ assert a in row
+ assert b in row
+
+ def test_columnclause_schema_column_three(self):
+ keyed2 = self.tables.keyed2
+
+ # this is also addressed by [ticket:2932]
+
+ a, b = sql.column('a'), sql.column('b')
+ stmt = text("select a, b from keyed2").columns(a=CHAR, b=CHAR)
+ row = testing.db.execute(stmt).first()
+
+ assert keyed2.c.a in row
+ assert keyed2.c.b in row
+ assert a in row
+ assert b in row
+ assert stmt.c.a in row
+ assert stmt.c.b in row
+
+
class LimitTest(fixtures.TestBase):