]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
removed 'primarytable' keyword argument
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 8 Jan 2006 01:35:56 +0000 (01:35 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 8 Jan 2006 01:35:56 +0000 (01:35 +0000)
doc/build/content/adv_datamapping.myt

index 1a6cce83376ab7ff71a55e177c0766f6ac16eec4..0dc1a0349f612b7ab332be7dacac40628476a08d 100644 (file)
@@ -227,7 +227,7 @@ WHERE rowcount.user_id = users.user_id ORDER BY users.oid, addresses.oid
 <&|formatting.myt:code&>
     # join users and addresses
     usersaddresses = sql.join(users, addresses, users.c.user_id == addresses.c.user_id)
-    m = mapper(User, usersaddresses, primarytable = users,  
+    m = mapper(User, usersaddresses,   
         properties = {
             'id' : [users.c.user_id, addresses.c.user_id],
         }
@@ -391,7 +391,7 @@ WHERE rowcount.user_id = users.user_id ORDER BY users.oid, addresses.oid
         class Customer(object):
             pass
         
-        mapper = mapper(Customer, s, primarytable=customers)
+        mapper = mapper(Customer, s)
     </&>
 <p>Above, the "customers" table is joined against the "orders" table to produce a full row for each customer row, the total count of related rows in the "orders" table, and the highest price in the "orders" table, grouped against the full set of columns in the "customers" table.  That query is then mapped against the Customer class.  New instances of Customer will contain attributes for each column in the "customers" table as well as an "order_count" and "highest_order" attribute.  Updates to the Customer object will only be reflected in the "customers" table and not the "orders" table.  This is because the primary keys of the "orders" table are not represented in this mapper and therefore the table is not affected by save or delete operations.</p>
 </&>
@@ -713,4 +713,4 @@ a full round-trip attribute tracking operation is illustrated:</p>
 </&>
 <p>Objects that contain the attribute "_instance_key" are already registered with the Identity Map, and are assumed to have come from the database.  They therefore get marked as "dirty" when changes happen.  Objects without an "_instance_key" are not from the database, and get marked as "new" when changes happen, although usually this will already have occured via the object's __init__ method.</p>
 </&>
-</&>
\ No newline at end of file
+</&>