]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Allow SQL expression for ORM primary keys
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 11 Feb 2019 22:00:47 +0000 (17:00 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 12 Feb 2019 21:55:48 +0000 (16:55 -0500)
commitc1f310df44033d943413170de878ce95fafa387e
tree1c053d5a0bf8610393ba38bbb19a576383da357b
parentbb7b353d6f97184d2689c8c682bab5caac4ec1e7
Allow SQL expression for ORM primary keys

A SQL expression can now be assigned to a primary key attribute for an ORM
flush in the same manner as ordinary attributes as described in
:ref:`flush_embedded_sql_expressions` where the expression will be evaulated
and then returned to the ORM using RETURNING, or in the case of pysqlite,
works using the cursor.lastrowid attribute.Requires either a database that
supports RETURNING (e.g. Postgresql, Oracle, SQL Server) or pysqlite.

Fixes: #3133
Fixes: #4494
Change-Id: I83da8357354de002cb04fa4a553f2a2f90c5157d
doc/build/changelog/unreleased_13/3133.rst [new file with mode: 0644]
doc/build/orm/persistence_techniques.rst
lib/sqlalchemy/orm/persistence.py
lib/sqlalchemy/sql/crud.py
test/orm/test_unitofwork.py
test/requirements.py
test/sql/test_insert.py