From b23bb79581ffab33231bc6fb7a49917888d4a836 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 2 Apr 2014 18:11:11 -0400 Subject: - reverse order of columns in sample CTEs as this is a UNION and the cols need to line up - alter this in the unit tests as well as these queries were just copied from the tests - remove the included_parts.join(parts) from the core CTE doc (also just copied from the test, where we want to make sure joins don't get screwed up with the CTE) as it doesn't contribute to the query itself fixes #3014 --- lib/sqlalchemy/sql/selectable.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index cfa229f94..2aa2c0f40 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -1467,8 +1467,8 @@ class SelectBase(Executable, FromClause): parts_alias = parts.alias() included_parts = included_parts.union_all( select([ - parts_alias.c.part, parts_alias.c.sub_part, + parts_alias.c.part, parts_alias.c.quantity ]). where(parts_alias.c.part==incl_alias.c.sub_part) @@ -1479,8 +1479,6 @@ class SelectBase(Executable, FromClause): func.sum(included_parts.c.quantity). label('total_quantity') ]).\ - select_from(included_parts.join(parts, - included_parts.c.part==parts.c.part)).\\ group_by(included_parts.c.sub_part) result = conn.execute(statement).fetchall() -- cgit v1.2.1