Skip to content

Commit 475ec2d

Browse files
committed
SA14: Adjust rewrite_update parameter mangling
This patch resembles the missing bits, where previously things have not been in order. It is about the correct wrapping/unwrapping of data returned to and from `rewrite_update`, which deviates between SA < 1.4 an SA >= 1.4.
1 parent d6264e6 commit 475ec2d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/crate/client/sqlalchemy/compiler.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,19 @@ def crate_before_execute(conn, clauseelement, multiparams, params):
8080
is_crate = type(conn.dialect).__name__ == 'CrateDialect'
8181
if is_crate and isinstance(clauseelement, sa.sql.expression.Update):
8282
if SA_VERSION >= SA_1_4:
83-
multiparams = ([params],)
83+
if params is None:
84+
multiparams = ([],)
85+
else:
86+
multiparams = ([params],)
8487
params = {}
8588

8689
clauseelement, multiparams, params = rewrite_update(clauseelement, multiparams, params)
8790

8891
if SA_VERSION >= SA_1_4:
89-
params = multiparams[0]
92+
if multiparams[0]:
93+
params = multiparams[0][0]
94+
else:
95+
params = multiparams[0]
9096
multiparams = []
9197

9298
return clauseelement, multiparams, params

0 commit comments

Comments
 (0)