]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
encourage usage of union() and other composites as module-level
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 25 Jan 2008 20:52:13 +0000 (20:52 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 25 Jan 2008 20:52:13 +0000 (20:52 +0000)
doc/build/content/sqlexpression.txt

index eaee0217591b75015f21b34ec6727a3732d2a61b..d97a43e63bb090e39465fafab39e10ca9f95882c 100644 (file)
@@ -744,10 +744,12 @@ If we wanted to use our `calculate` statement twice with different bind paramete
     
 ### Unions and Other Set Operations {@name=unions}
 
-Unions come in two flavors, UNION and UNION ALL, which are available via module level functions or methods off a Selectable:
+Unions come in two flavors, UNION and UNION ALL, which are available via module level functions:
 
     {python}
-    >>> u = addresses.select(addresses.c.email_address=='foo@bar.com').union(
+    >>> from sqlalchemy.sql import union
+    >>> u = union(
+    ...     addresses.select(addresses.c.email_address=='foo@bar.com'),
     ...    addresses.select(addresses.c.email_address.like('%@yahoo.com')),
     ... ).order_by(addresses.c.email_address)
 
@@ -763,7 +765,9 @@ Unions come in two flavors, UNION and UNION ALL, which are available via module
 Also available, though not supported on all databases, are `intersect()`, `intersect_all()`, `except_()`, and `except_all()`:
 
     {python}
-    >>> u = addresses.select(addresses.c.email_address.like('%@%.com')).except_(
+    >>> from sqlalchemy.sql import except_
+    >>> u = except_(
+    ...    addresses.select(addresses.c.email_address.like('%@%.com')),
     ...    addresses.select(addresses.c.email_address.like('%@msn.com'))
     ... )