mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-25 18:34:32 +02:00
Create table if_not_exists=True argument, closes #397
This commit is contained in:
parent
79b5b58354
commit
aa24903113
3 changed files with 33 additions and 3 deletions
|
|
@ -1114,3 +1114,12 @@ def test_create(fresh_db):
|
|||
" [bytes] BLOB\n"
|
||||
")"
|
||||
)
|
||||
|
||||
|
||||
def test_create_if_not_exists(fresh_db):
|
||||
fresh_db["t"].create({"id": int})
|
||||
# This should error
|
||||
with pytest.raises(sqlite3.OperationalError):
|
||||
fresh_db["t"].create({"id": int})
|
||||
# This should not
|
||||
fresh_db["t"].create({"id": int}, if_not_exists=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue