Skip to content

Commit

Permalink
BulkResponse: Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Oct 6, 2024
1 parent 6a58353 commit af32409
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/query.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@ for every tuple. This dictionary always has a ``rowcount`` key, indicating
how many rows were inserted. If an error occurs, the ``rowcount`` value is
``-2``, and the dictionary may additionally have an ``error_message`` key.

The package includes a helper utility ``BulkResponse`` that supports parsing
such responses to bulk operation requests. It works like this::

from crate.client.result import BulkResponse

result = cursor.executemany(statement, records)
bulk_response = BulkResponse(records, result)

It provides properties ``failed_records``, ``record_count``, ``success_count``,
and ``failed_count``. ``failed_records`` will provide information which records
of the bulk operation failed to succeed, by evaluating ``{'rowcount': -2}``
items, and matching them against submitted records.


.. _selects:

Selecting data
Expand Down

0 comments on commit af32409

Please sign in to comment.