]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
ORM executemany returning
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 17 Apr 2020 14:55:08 +0000 (10:55 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 28 Jun 2020 01:30:37 +0000 (21:30 -0400)
commit08c46eea924d23a234bf3feea1a928eb8ae8a00a
tree3795e1d04fa0e35c1e93080320b43c8fe0ed792e
parent2d9387354f11da322c516412eb5dfe937163c90b
ORM executemany returning

Build on #5401 to allow the ORM to take advanage
of executemany INSERT + RETURNING.

Implemented the feature

updated tests

to support INSERT DEFAULT VALUES, needed to come up with
a new syntax for compiler INSERT INTO table (anycol) VALUES (DEFAULT)
which can then be iterated out for executemany.

Added graceful degrade to plain executemany for PostgreSQL <= 8.2

Renamed EXECUTEMANY_DEFAULT to EXECUTEMANY_PLAIN

Fix issue where unicode identifiers or parameter names wouldn't
work with execute_values() under Py2K, because we have to
encode the statement and therefore have to encode the
insert_single_values_expr too.

Correct issue from #5401 to support executemany + return_defaults
for a PK that is explicitly pre-generated, meaning we aren't actually
getting RETURNING but need to return it from compiled_parameters.

Fixes: #5263
Change-Id: Id68e5c158c4f9ebc33b61c06a448907921c2a657
16 files changed:
doc/build/changelog/migration_14.rst
doc/build/changelog/unreleased_14/5263.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/postgresql/psycopg2.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/orm/persistence.py
lib/sqlalchemy/sql/crud.py
lib/sqlalchemy/testing/assertions.py
lib/sqlalchemy/testing/assertsql.py
test/dialect/postgresql/test_dialect.py
test/orm/inheritance/test_basic.py
test/orm/test_bulk.py
test/orm/test_cycles.py
test/orm/test_defaults.py
test/orm/test_unitofwork.py
test/orm/test_unitofworkv2.py
test/sql/test_insert.py