summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ansisql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2005-12-30 05:58:45 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2005-12-30 05:58:45 +0000
commit5ceef4809d2eeb5030eb25668064b0a4a6262eba (patch)
tree1e0053ff3ab865d7884324d81caa450d443cc96b /lib/sqlalchemy/ansisql.py
parent24bb21e8db0470443378057f2a1444de498c1e56 (diff)
downloadsqlalchemy-5ceef4809d2eeb5030eb25668064b0a4a6262eba.tar.gz
changes related to mapping against arbitrary selects, selects with labels or functions:
testfunction has a more complete test (needs an assert tho); added new labels, synonymous with column key, to "select" statements that are subqueries with use_labels=False, since SQLite wants them - this also impacts the names of the columns attached to the select object in the case that the key and name dont match, since it is now the key, not the name; aliases generate random names if name is None (need some way to make them more predictable to help plan caching); select statements have a rowid column of None, since there isnt really a "rowid"...at least cant figure out what it would be yet; mapper creates an alias if given a select to map against, since Postgres wants it; mapper checks if it has pks for a given table before saving/deleting, skips it otherwise; mapper will not try to order by rowid if table doesnt have a rowid (since select statements dont have rowids...)
Diffstat (limited to 'lib/sqlalchemy/ansisql.py')
-rw-r--r--lib/sqlalchemy/ansisql.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sqlalchemy/ansisql.py b/lib/sqlalchemy/ansisql.py
index 8df5e5352..abbc06751 100644
--- a/lib/sqlalchemy/ansisql.py
+++ b/lib/sqlalchemy/ansisql.py
@@ -262,6 +262,13 @@ class ANSICompiler(sql.Compiled):
l = co.label(co._label)
l.accept_visitor(self)
inner_columns[co._label] = l
+ elif select.issubquery and isinstance(co, Column):
+ # SQLite doesnt like selecting from a subquery where the column
+ # names look like table.colname, so add a label synonomous with
+ # the column name
+ l = co.label(co.key)
+ l.accept_visitor(self)
+ inner_columns[self.get_str(l.obj)] = l
else:
co.accept_visitor(self)
inner_columns[self.get_str(co)] = co