- attached union_with_join.py
Joining to a union that has single column does not work.
Issue #1853
resolved
See attached script.
When doing a union of only one column such as session.query(user.id).union(session.query(user.id)), makes this query unjoinable to.
Works in 0.58 as expected Fails in 0.62
Tested in both postgres and sqlite.
Comments (6)
-
Account Deleted -
repo owner - changed milestone to 0.6.3
-
repo owner here's a patch:
diff -r 10db67be5b783b94b59dd7cf039f8c322cf837c8 lib/sqlalchemy/orm/query.py --- a/lib/sqlalchemy/orm/query.py Wed Jul 14 14:50:45 2010 -0400 +++ b/lib/sqlalchemy/orm/query.py Wed Jul 14 21:39:57 2010 -0400 @@ -2622,7 +2622,9 @@ return self.column.type def adapt_to_selectable(self, query, sel): - _ColumnEntity(query, sel.corresponding_column(self.column)) + c = _ColumnEntity(query, sel.corresponding_column(self.column)) + c.entities = self.entities + c.entity_zero = self.entity_zero def setup_entity(self, entity, mapper, adapter, from_obj, is_aliased_class, with_polymorphic):
will have to work up some tests, also want to remember why annotations aren't getting transferred here.
-
repo owner and also, we need to produce an error of some kind if
_joinpoint_zero()
is returningNone
. i.e. fails:session.query(users_table.c.id).select_from(users_table).join(User)
-
repo owner - changed status to resolved
-
repo owner - removed milestone
Removing milestone: 0.6.3 (automated comment)
- Log in to comment
joining to a union with one column example