mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-28 21:04:13 +02:00
Remove upsert() requires a pk checks
This commit is contained in:
parent
fe3a3d4000
commit
2ab894dd73
1 changed files with 0 additions and 5 deletions
|
|
@ -3004,9 +3004,6 @@ class Table(Queryable):
|
||||||
return a list of ``(sql, parameters)`` 2-tuples which, when executed in
|
return a list of ``(sql, parameters)`` 2-tuples which, when executed in
|
||||||
order, perform the desired INSERT / UPSERT / REPLACE operation.
|
order, perform the desired INSERT / UPSERT / REPLACE operation.
|
||||||
"""
|
"""
|
||||||
if (upsert or replace) and not pk:
|
|
||||||
raise PrimaryKeyRequired("UPSERT / REPLACE needs a primary key")
|
|
||||||
|
|
||||||
if hash_id_columns and hash_id is None:
|
if hash_id_columns and hash_id is None:
|
||||||
hash_id = "id"
|
hash_id = "id"
|
||||||
|
|
||||||
|
|
@ -3319,8 +3316,6 @@ class Table(Queryable):
|
||||||
if hash_id_columns and hash_id is None:
|
if hash_id_columns and hash_id is None:
|
||||||
hash_id = "id"
|
hash_id = "id"
|
||||||
|
|
||||||
if upsert and (not pk and not hash_id):
|
|
||||||
raise PrimaryKeyRequired("upsert() requires a pk")
|
|
||||||
assert not (hash_id and pk), "Use either pk= or hash_id="
|
assert not (hash_id and pk), "Use either pk= or hash_id="
|
||||||
if hash_id_columns and (hash_id is None):
|
if hash_id_columns and (hash_id is None):
|
||||||
hash_id = "id"
|
hash_id = "id"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue