From: Mike Bayer Date: Sun, 14 Jan 2007 21:21:02 +0000 (+0000) Subject: [ticket:398] X-Git-Tag: rel_0_3_4~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6584e033a9b232f5c273f206a5c7540c89e364e1;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git [ticket:398] --- diff --git a/doc/build/content/datamapping.txt b/doc/build/content/datamapping.txt index 76937c87d1..428c72d750 100644 --- a/doc/build/content/datamapping.txt +++ b/doc/build/content/datamapping.txt @@ -200,6 +200,8 @@ The mapped class can also specify whatever methods and/or constructor it wants: >>> u User id 1 name 'john' password 'foo' +Note that the **__init__() method is not called when the instance is loaded**. This is so that classes can define operations that are specific to their initial construction which are not re-called when the object is restored from the database, and is similar in concept to how Python's `pickle` module calls `__new__()` when deserializing instances. To allow `__init__()` to be called at object load time, or to define any other sort of on-load operation, create a `MapperExtension` which supplies the `create_instance()` method (see [advdatamapping_extending](rel:advdatamapping_extending), as well as the example in the FAQ). + SQLAlchemy will only put modified object attributes columns into the UPDATE statements generated upon flush. This is to conserve database traffic and also to successfully interact with a "deferred" attribute, which is a mapped object attribute against the mapper's primary table that isnt loaded until referenced by the application. ### Defining and Using Relationships {@name=relations}