summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/crud.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2022-12-02 11:58:40 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-12-05 09:59:01 -0500
commit06c234d037bdab48e716d6c5f5dc200095269474 (patch)
tree8ed48e0627f0e4816b7e26f9e6294330f1ba19d6 /lib/sqlalchemy/sql/crud.py
parent9058593e0b28cee0211251de6604e4601ff69a00 (diff)
downloadsqlalchemy-06c234d037bdab48e716d6c5f5dc200095269474.tar.gz
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
Diffstat (limited to 'lib/sqlalchemy/sql/crud.py')
-rw-r--r--lib/sqlalchemy/sql/crud.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/crud.py b/lib/sqlalchemy/sql/crud.py
index 017ff7baa..ae1b032ae 100644
--- a/lib/sqlalchemy/sql/crud.py
+++ b/lib/sqlalchemy/sql/crud.py
@@ -85,8 +85,8 @@ _CrudParamElement = Tuple[
]
_CrudParamElementStr = Tuple[
"KeyedColumnElement[Any]",
- str,
- str,
+ str, # column name
+ str, # placeholder
Iterable[str],
]
_CrudParamElementSQLExpr = Tuple[