mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 09:54:31 +02:00
upsert_all() now works with not_null - refs #538
This commit is contained in:
parent
80763edaa2
commit
2376c452a5
2 changed files with 27 additions and 5 deletions
|
|
@ -28,6 +28,16 @@ def test_upsert_all_single_column(fresh_db):
|
|||
assert table.pks == ["name"]
|
||||
|
||||
|
||||
def test_upsert_all_not_null(fresh_db):
|
||||
# https://github.com/simonw/sqlite-utils/issues/538
|
||||
fresh_db["comments"].upsert_all(
|
||||
[{"id": 1, "name": "Cleo"}],
|
||||
pk="id",
|
||||
not_null=["name"],
|
||||
)
|
||||
assert list(fresh_db["comments"].rows) == [{"id": 1, "name": "Cleo"}]
|
||||
|
||||
|
||||
def test_upsert_error_if_no_pk(fresh_db):
|
||||
table = fresh_db["table"]
|
||||
with pytest.raises(PrimaryKeyRequired):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue