Mike Bayer avatar Mike Bayer committed 48319e1

formatting etc

Comments (0)

Files changed (1)

doc/build/content/sqlconstruction.txt

     # or get the underlying DBAPI cursor object
     cursor = result.cursor
     
-    # close the result.  If the statement was implicitly executed (i.e. without an explicit Connection), this will
-    # return the underlying connection resources back to the connection pool.  de-referencing the result
-    # will also have the same effect.
-    # if an explicit Connection was used, then close() does nothing.
+    # close the result.  If the statement was implicitly executed 
+    # (i.e. without an explicit Connection), this will
+    # return the underlying connection resources back to 
+    # the connection pool.  de-referencing the result
+    # will also have the same effect.  if an explicit Connection was 
+    # used, then close() does nothing.
     result.close()
 
 #### Using Column Labels {@name=labels}
 You can also specify custom labels on a per-column basis using the `label()` function:
 
     {python title="label() Function on Column"}
-    {sql}c = select([users.c.user_id.label('id'), users.c.user_name.label('name')]).execute()  
+    {sql}c = select([users.c.user_id.label('id'), 
+               users.c.user_name.label('name')]).execute()  
     SELECT users.user_id AS id, users.user_name AS name
     FROM users
     {}
     users.select(users.c.user_id.in_(1,2,3))
     
     # and_, endswith, equality operators
-    users.select(and_(addresses.c.street.endswith('green street'), addresses.c.zip=='11234'))
+    users.select(and_(addresses.c.street.endswith('green street'),
+                    addresses.c.zip=='11234'))
     
     # & operator subsituting for 'and_'
     users.select(addresses.c.street.endswith('green street') & (addresses.c.zip=='11234'))
 A join can be created on its own using the `join` or `outerjoin` functions, or can be created off of an existing Table or other selectable unit via the `join` or `outerjoin` methods:
         
     {python}
-    {sql}outerjoin(users, addresses, users.c.user_id==addresses.c.address_id).select().execute()
+    {sql}outerjoin(users, addresses, 
+               users.c.user_id==addresses.c.address_id).select().execute()
     SELECT users.user_id, users.user_name, users.password, addresses.address_id, 
     addresses.user_id, addresses.street, addresses.city, addresses.state, addresses.zip
     FROM users LEFT OUTER JOIN addresses ON users.user_id = addresses.address_id
 Subqueries can be used in the column clause of a select statement by specifying the `scalar=True` flag:
 
     {python}
-    {sql}select([table2.c.col1, table2.c.col2, select([table1.c.col1], table1.c.col2==7, scalar=True)])
+    {sql}select([table2.c.col1, table2.c.col2, 
+                    select([table1.c.col1], table1.c.col2==7, scalar=True)])
     SELECT table2.col1, table2.col2, 
     (SELECT table1.col1 AS col1 FROM table1 WHERE col2=:table1_col2) 
     FROM table2
 
     {python}s = select([addresses.c.city], addresses.c.user_id==users.c.user_id)
     {sql}users.update(
-        and_(users.c.user_id>10, users.c.user_id<20), 
+        and_(users.c.user_id>10, users.c.user_id<20), 
         values={users.c.user_name:s}
     ).execute() 
     UPDATE users SET user_name=(SELECT addresses.city 
     FROM addresses 
     WHERE addresses.user_id = users.user_id) 
-    WHERE users.user_id > :users_user_id AND users.user_id &lt; :users_user_id_1
+    WHERE users.user_id > :users_user_id AND users.user_id < :users_user_id_1
     {'users_user_id_1': 20, 'users_user_id': 10}
 
 ### Deletes {@name=delete}
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.