Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit 9e93405

Browse files
authored
Fix SQLite fetch queries with multiple parameters (#435)
SQLAlchemy 1.4 no longer orders `compiled.bind_names` the same as the sequence of `?` placeholders in the generated SQL. We must iterate keys from `compiled.positiontup` that stores the correct order of bound parameters. Backport of athenianco#5
1 parent 8266962 commit 9e93405

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

databases/backends/sqlite.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ def _compile(
167167
args = []
168168

169169
if not isinstance(query, DDLElement):
170-
for key, raw_val in compiled.construct_params().items():
170+
params = compiled.construct_params()
171+
for key in compiled.positiontup:
172+
raw_val = params[key]
171173
if key in compiled._bind_processors:
172174
val = compiled._bind_processors[key](raw_val)
173175
else:

0 commit comments

Comments
 (0)