Skip to content

0.12.0

Choose a tag to compare

@Totktonada Totktonada released this 28 Jun 19:32
· 186 commits to master since this release

Overview

This release offers support of several *_many() and *_object_many()
operations to insert/replace/upsert many tuples at once.

Those operations are faster for many tuples/operations of the same kind.
Say, if you want to add large amount of data into the cluster, invoke
insert_many() with 100 (or 1000, depends of the size) tuples per call.

Breaking changes

There are no breaking changes in the release.

New features

  • Insert many tuples/objects at once (#193).

    crud.insert_many(space_name, tuples, opts)
    crud.insert_object_many(space_name, objects, opts)
  • Replace many tuples/objects at once (#193).

    crud.replace_many(space_name, tuples, opts)
    crud.replace_object_many(space_name, objects, opts)
  • Perform many upsert operations at once (#193).

    crud.upsert_many(space_name, tuples_operation_data, opts)
    crud.upsert_object_many(space_name, objects_operation_data, opts)

Example:

crud.replace_many('developers', {
  {1, box.NULL, 'Elizabeth', 'lizaaa'},
  {2, box.NULL, 'Anastasia', 'iamnewdeveloper'},
})
---
- metadata:
  - {'name': 'id', 'type': 'unsigned'}
  - {'name': 'bucket_id', 'type': 'unsigned'}
  - {'name': 'name', 'type': 'string'}
  - {'name': 'login', 'type': 'string'}
  rows:
  - [1, 477, 'Elizabeth', 'lizaaa']
  - [2, 401, 'Anastasia', 'iamnewdeveloper']
...

The *_many() operations have almost same options as
insert/replace/upsert and two new ones to control how errors are
interpreted on a storage:

  • stop_on_error (boolean, default is false)

    If an error occurs on a storage, stop processing operations of the
    request on given storage.

    Only on the storage, where the error occurs.

  • rollback_on_error (boolean, default is false)

    Rollback all changes on the storage, where an error occurs.

    Only on the storage, where the error occurs.

The operations may succeed partially, so data and errors will be
returned both. Several errors can occur at a single request: those calls
return an array of errors, where each error contains the problematic
tuple/object. Consider the README for the detailed description.

Be ready to errors that are not recoverable without interaction with a
human. This implementation does NOT perform cluster wide transactions or
two phare commit: all rollbacks are made only on particular storage.