diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-15 16:42:29 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-15 16:42:29 -0500 |
commit | dff5a404e489d5215da5aa30870b78aca8423de5 (patch) | |
tree | 39f6ae1949762d269f6a73e0315f0fa6910ceacd /lib/sqlalchemy/engine/base.py | |
parent | fc0ffac24155931c2db10d1a469e1f7898268e45 (diff) | |
download | sqlalchemy-dff5a404e489d5215da5aa30870b78aca8423de5.tar.gz |
- getting slightly more consistent behavior for the edge case of pk columns
with server default - autoincrement is now false with any server_default,
so these all return None, applies consistency to [ticket:2020], [ticket:2021].
if prefetch is desired a "default" should be used instead of server_default.
Diffstat (limited to 'lib/sqlalchemy/engine/base.py')
-rw-r--r-- | lib/sqlalchemy/engine/base.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index 3bdcad2ac..9eb1b8b40 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -2460,9 +2460,23 @@ class ResultProxy(object): @util.memoized_property def inserted_primary_key(self): """Return the primary key for the row just inserted. - - This only applies to single row insert() constructs which - did not explicitly specify returning(). + + The return value is a list of scalar values + corresponding to the list of primary key columns + in the target table. + + This only applies to single row :func:`.insert` + constructs which did not explicitly specify + :meth:`.Insert.returning`. + + Note that primary key columns which specify a + server_default clause, + or otherwise do not qualify as "autoincrement" + columns (see the notes at :class:`.Column`), and were + generated using the database-side default, will + appear in this list as ``None`` unless the backend + supports "returning" and the insert statement executed + with the "implicit returning" enabled. """ |