]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fix typos, SQL server also needs union all
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 3 Mar 2012 18:10:37 +0000 (13:10 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 3 Mar 2012 18:10:37 +0000 (13:10 -0500)
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/sql/expression.py

index 5b7f7c9af4160f9d663e0b07e8575bde929ff64f..aa3dd0173ead4279bc4540d48abb114c369a355e 100644 (file)
@@ -472,8 +472,8 @@ class Query(object):
 
             class Part(Base):
                 __tablename__ = 'part'
-                part = Column(String)
-                sub_part = Column(String)
+                part = Column(String, primary_key=True)
+                sub_part = Column(String, primary_key=True)
                 quantity = Column(Integer)
 
             included_parts = session.query(
@@ -485,7 +485,7 @@ class Query(object):
 
             incl_alias = aliased(included_parts, name="pr")
             parts_alias = aliased(Part, name="p")
-            included_parts = included_parts.union(
+            included_parts = included_parts.union_all(
                 session.query(
                     parts_alias.part, 
                     parts_alias.sub_part, 
@@ -496,7 +496,7 @@ class Query(object):
             q = session.query(
                     included_parts.c.sub_part,
                     func.sum(included_parts.c.quantity).label('total_quantity')
-                ).\
+                ).\\
                 group_by(included_parts.c.sub_part)
 
         See also:
index 22fe6c420f2d58d7c41bb3e6eab559c8631ee3f6..50b7375bfc8535e013e51d9740f238e197195f4c 100644 (file)
@@ -4353,7 +4353,7 @@ class _SelectBase(Executable, FromClause):
          compile time.
         :param recursive: if ``True``, will render ``WITH RECURSIVE``.
          A recursive common table expression is intended to be used in 
-         conjunction with UNION or UNION ALL in order to derive rows
+         conjunction with UNION ALL in order to derive rows
          from those already selected.
 
         The following examples illustrate two examples from 
@@ -4422,7 +4422,7 @@ class _SelectBase(Executable, FromClause):
 
             incl_alias = included_parts.alias()
             parts_alias = parts.alias()
-            included_parts = included_parts.union(
+            included_parts = included_parts.union_all(
                 select([
                     parts_alias.c.part, 
                     parts_alias.c.sub_part,