mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-27 19:34:32 +02:00
Use jsonify_if_need for sql updates (#204)
* add failing tests for update with json values * use jsonify_if_needed in for sql updates Thanks, @mfa
This commit is contained in:
parent
60d3c4821b
commit
c5f4f0f70c
2 changed files with 30 additions and 2 deletions
|
|
@ -1426,7 +1426,7 @@ class Table(Queryable):
|
|||
validate_column_names(updates.keys())
|
||||
for key, value in updates.items():
|
||||
sets.append("[{}] = {}".format(key, conversions.get(key, "?")))
|
||||
args.append(value)
|
||||
args.append(jsonify_if_needed(value))
|
||||
wheres = ["[{}] = ?".format(pk_name) for pk_name in pks]
|
||||
args.extend(pk_values)
|
||||
sql = "update [{table}] set {sets} where {wheres}".format(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue