You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>>> db['foo3'].upsert_all([{"name": "hello"}], pk="name")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/simon/.local/share/virtualenvs/datasette.io-TK86ygSO/lib/python3.9/site-packages/sqlite_utils/db.py", line 1837, in upsert_all
return self.insert_all(
File "/Users/simon/.local/share/virtualenvs/datasette.io-TK86ygSO/lib/python3.9/site-packages/sqlite_utils/db.py", line 1778, in insert_all
self.insert_chunk(
File "/Users/simon/.local/share/virtualenvs/datasette.io-TK86ygSO/lib/python3.9/site-packages/sqlite_utils/db.py", line 1588, in insert_chunk
result = self.db.execute(query, params)
File "/Users/simon/.local/share/virtualenvs/datasette.io-TK86ygSO/lib/python3.9/site-packages/sqlite_utils/db.py", line 213, in execute
return self.conn.execute(sql, parameters)
sqlite3.OperationalError: near "WHERE": syntax error
wheres=" AND ".join("[{}] = ?".format(pk) forpkinpks),
)
Note how set_cols = [col for col in all_columns if col not in pks] can potentially return an empty list if ALL of the columns are primary keys - but the next line of code that assigns sql2 continues regardless, when it should instead be skipped if there are no columns in set_cols.
This works:
But this fails:
With the debugger:
The text was updated successfully, but these errors were encountered: