From 99da46f7258225fc6fd8e94ddc20859ccccc4109 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Wed, 30 Nov 2022 18:07:48 -0800 Subject: [PATCH] Docs for insert API ignore/replace - closes #1924 --- docs/json_api.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/json_api.rst b/docs/json_api.rst index d234b852..46973616 100644 --- a/docs/json_api.rst +++ b/docs/json_api.rst @@ -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: Updating a row