]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Rewrite positional handling, test for "numeric"
authorFederico Caselli <cfederico87@gmail.com>
Fri, 2 Dec 2022 16:58:40 +0000 (11:58 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 5 Dec 2022 14:59:01 +0000 (09:59 -0500)
commit06c234d037bdab48e716d6c5f5dc200095269474
tree8ed48e0627f0e4816b7e26f9e6294330f1ba19d6
parent9058593e0b28cee0211251de6604e4601ff69a00
Rewrite positional handling, test for "numeric"

Changed how the positional compilation is performed. It's rendered by the compiler
the same as the pyformat compilation. The string is then processed to replace
the placeholders with the correct ones, and to obtain the correct order of the
parameters.
This vastly simplifies the computation of the order of the parameters, that in
case of nested CTE is very hard to compute correctly.

Reworked how numeric paramstyle behavers:
- added support for repeated parameter, without duplicating them like in normal
positional dialects
- implement insertmany support. This requires that the dialect supports out of
order placehoders, since all parameters that are not part of the VALUES clauses
are placed at the beginning of the parameter tuple
- support for different identifiers for a numeric parameter. It's for example
possible to use postgresql style placeholder $1, $2, etc

Added two new dialect based on sqlite to test "numeric" fully using
both :1 style and $1 style. Includes a workaround for SQLite's
not-really-correct numeric implementation.

Changed parmstyle of asyncpg dialect to use numeric, rendering with its native
$ identifiers

Fixes: #8926
Fixes: #8849
Change-Id: I7c640467d49adfe6d795cc84296fc7403dcad4d6
28 files changed:
doc/build/changelog/unreleased_20/8849.rst [new file with mode: 0644]
doc/build/changelog/unreleased_20/8926.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/postgresql/asyncpg.py
lib/sqlalchemy/dialects/sqlite/provision.py
lib/sqlalchemy/dialects/sqlite/pysqlite.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/engine/interfaces.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/crud.py
lib/sqlalchemy/testing/assertsql.py
lib/sqlalchemy/testing/config.py
lib/sqlalchemy/testing/plugin/plugin_base.py
setup.cfg
test/dialect/postgresql/test_query.py
test/dialect/test_sqlite.py
test/engine/test_logging.py
test/orm/dml/test_bulk_statements.py
test/orm/test_dynamic.py
test/orm/test_merge.py
test/orm/test_unitofworkv2.py
test/requirements.py
test/sql/test_compiler.py
test/sql/test_cte.py
test/sql/test_insert.py
test/sql/test_resultset.py
test/sql/test_types.py
test/sql/test_update.py
tox.ini