Mike Bayer avatar Mike Bayer committed e9f84aa

fix typos, SQL server also needs union all

Comments (0)

Files changed (2)

lib/sqlalchemy/orm/query.py

 
             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(
 
             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, 
             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:

lib/sqlalchemy/sql/expression.py

          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 
 
             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, 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.