diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-08-25 15:00:54 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-08-25 15:00:54 -0400 |
commit | df1113ac19842ca0b30c13fb1d6031fa7f24371b (patch) | |
tree | c3f8c20cb942056724345de6b9f5d387495c174a | |
parent | b1d8d74b525be1ec37ebb35b2ce6e6548c557aa4 (diff) | |
download | sqlalchemy-df1113ac19842ca0b30c13fb1d6031fa7f24371b.tar.gz |
- fix server-side non-returning example
- mention eager_defaults
-rw-r--r-- | doc/build/orm/mapper_config.rst | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/doc/build/orm/mapper_config.rst b/doc/build/orm/mapper_config.rst index 88b256ae2..c35e3429c 100644 --- a/doc/build/orm/mapper_config.rst +++ b/doc/build/orm/mapper_config.rst @@ -1274,7 +1274,8 @@ automatically providing the new value of the version id counter. The ORM typically does not actively fetch the values of database-generated values when it emits an INSERT or UPDATE, instead leaving these columns as -"expired" and to be fetched when they are next accessed. However, when a +"expired" and to be fetched when they are next accessed, unless the ``eager_defaults`` +:func:`.mapper` flag is set. However, when a server side version column is used, the ORM needs to actively fetch the newly generated value. This is so that the version counter is set up *before* any concurrent transaction may update it again. This fetching is also @@ -1291,10 +1292,10 @@ like this:: Where above, the ORM can acquire any newly generated primary key values along with server-generated version identifiers in one statement. When the backend does not support RETURNING, an additional SELECT must be emitted for **every** -INSERT, which is much less efficient, and also introduces the possibility of +INSERT and UPDATE, which is much less efficient, and also introduces the possibility of missed version counters:: - INSERT INTO "user" (name) VALUES (%(name)s) RETURNING "user".id, "user".version_id + INSERT INTO "user" (name) VALUES (%(name)s) {'name': 'ed'} SELECT "user".version_id AS user_version_id FROM "user" where |