Skip to content

Commit af32409

Browse files
committed
BulkResponse: Add documentation
1 parent 6a58353 commit af32409

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/query.rst

+14
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,20 @@ for every tuple. This dictionary always has a ``rowcount`` key, indicating
7676
how many rows were inserted. If an error occurs, the ``rowcount`` value is
7777
``-2``, and the dictionary may additionally have an ``error_message`` key.
7878

79+
The package includes a helper utility ``BulkResponse`` that supports parsing
80+
such responses to bulk operation requests. It works like this::
81+
82+
from crate.client.result import BulkResponse
83+
84+
result = cursor.executemany(statement, records)
85+
bulk_response = BulkResponse(records, result)
86+
87+
It provides properties ``failed_records``, ``record_count``, ``success_count``,
88+
and ``failed_count``. ``failed_records`` will provide information which records
89+
of the bulk operation failed to succeed, by evaluating ``{'rowcount': -2}``
90+
items, and matching them against submitted records.
91+
92+
7993
.. _selects:
8094

8195
Selecting data

0 commit comments

Comments
 (0)