mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Docs for insert API ignore/replace - closes #1924
This commit is contained in:
parent
7fde34cfcb
commit
99da46f725
1 changed files with 22 additions and 0 deletions
|
|
@ -560,6 +560,28 @@ If any of your rows have a primary key that is already in use, you will get an e
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pass ``"ignore": true`` to ignore these errors and insert the other rows:
|
||||||
|
|
||||||
|
.. code-block:: json
|
||||||
|
|
||||||
|
{
|
||||||
|
"rows": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"column1": "value1",
|
||||||
|
"column2": "value2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"column1": "value3",
|
||||||
|
"column2": "value4"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ignore": true
|
||||||
|
}
|
||||||
|
|
||||||
|
Or you can pass ``"replace": true`` to replace any rows with conflicting primary keys with the new values.
|
||||||
|
|
||||||
.. _RowUpdateView:
|
.. _RowUpdateView:
|
||||||
|
|
||||||
Updating a row
|
Updating a row
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue