From: Mike Bayer Date: Tue, 14 Mar 2006 16:49:15 +0000 (+0000) Subject: formatting... X-Git-Tag: rel_0_1_5~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc43d50cec01cf3adf7a37b799f470f9445f3313;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git formatting... --- diff --git a/doc/build/content/datamapping.myt b/doc/build/content/datamapping.myt index febf9bf8be..10dd6e475c 100644 --- a/doc/build/content/datamapping.myt +++ b/doc/build/content/datamapping.myt @@ -343,16 +343,16 @@ DELETE FROM addresses WHERE addresses.address_id = :address_id True -+

The backreference feature also works with many-to-many relationships, which are described later. When creating a backreference, a corresponding property is placed on the child mapper. The default arguments to this property can be overridden using the backref() function: +

The backreference feature also works with many-to-many relationships, which are described later. When creating a backreference, a corresponding property is placed on the child mapper. The default arguments to this property can be overridden using the backref() function: <&|formatting.myt:code&> Address.mapper = mapper(Address, addresses) User.mapper = mapper(User, users, properties = { - 'addresses' : relation(Address.mapper, backref=backref('user', lazy=False, private=True)) + 'addresses' : relation(Address.mapper, + backref=backref('user', lazy=False, private=True)) } ) -

Note that when overriding a backreferenced property, we re-specify the backreference as well. This will not override the existing 'addresses' property on the User class, but just sends a message to the attribute-management system that it should continue to maintain this backreference.

<&|doclib.myt:item, name="cascade", description="Creating Relationships Automatically with cascade_mappers" &>

The mapper package has a helper function cascade_mappers() which can simplify the task of linking several mappers together. Given a list of classes and/or mappers, it identifies the foreign key relationships between the given mappers or corresponding class mappers, and creates relation() objects representing those relationships, including a backreference. Attempts to find