add bulk update

This commit is contained in:
steve-chavez
2022-06-16 11:11:37 -05:00
committed by Steve Chavez
parent 5305998a95
commit 13ce0f3354
3 changed files with 40 additions and 0 deletions
+33
View File
@@ -1720,6 +1720,39 @@ Doing a full table update without filters is not allowed and will result in 0 up
Updates also support :code:`Prefer: return=representation` plus :ref:`v_filter`.
.. _bulk_update:
Bulk Update
-----------
You can update rows with different data by providing a JSON array of objects having uniform keys, the rows will be chosen based on the primary key column(s) values.
.. tabs::
.. code-tab:: http
PATCH /employees HTTP/1.1
[
{ "id": 1, "name": "Renamed employee 1", "salary": 40000 },
{ "id": 2, "name": "Renamed employee 2", "salary": 52000 },
{ "id": 3, "name": "Renamed employee 3", "salary": 60000 }
]
.. code-tab:: bash Curl
curl "http://localhost:3000/employees" \
-X PATCH -H "Content-Type: application/json" \
-d @- << EOF
[
{ "id": 1, "name": "Renamed employee 1", "salary": 40000 },
{ "id": 2, "name": "Renamed employee 2", "salary": 52000 },
{ "id": 3, "name": "Renamed employee 3", "salary": 60000 }
]
EOF
You must not include any filters for this to work. If you provide filters, only the values of the first object in the array will be used for the update.
.. _upsert:
Upsert
+5
View File
@@ -10,6 +10,11 @@ Features
API
~~~
Bulk Update
^^^^^^^^^^^
See :ref:`bulk_update`.
Access Composite Type fields and Array elements
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+2
View File
@@ -182,6 +182,8 @@ unicode
unix
updatable
UPSERT
Upsert
upsert
uri
url
urls