graflo.db.arango.bulk¶
Pieces of the ArangoDB bulk writer that need no server.
Documents go to POST /_api/import as JSON Lines (type=documents) with
onDuplicate=ignore. Every document carries the _key its identity
determines, so a replayed request creates nothing twice.
Attributes¶
IMPORT_REQUEST_BYTES = 4 << 20
module-attribute
¶
Classes¶
ArangoImportError
¶
Functions:¶
check_import(result, *, sent, replay, collection)
¶
Refuse an import that did not store all sent documents.
A document ignored as a duplicate is stored already: expected on a replay,
and on a first write a sign that two documents share a _key.
Raises:
| Type | Description |
|---|---|
ArangoImportError
|
The server reported errors, ignored a document of a first write, or accounted for fewer documents than were sent. |
Source code in graflo/db/arango/bulk.py
edge_collections(schema)
¶
Each edge collection of schema, with the stored edges it holds.
Source code in graflo/db/arango/bulk.py
edge_count_query(collection)
¶
AQL counting collection's edges per source, relation and target collection.
Source code in graflo/db/arango/bulk.py
import_bodies(docs, limit=IMPORT_REQUEST_BYTES)
¶
JSON Lines request bodies of at most limit bytes, with their line counts.
Values are encoded as the upsert path encodes them; text is ASCII-escaped, as the HTTP client sends a text body. A line longer than limit goes alone.
Source code in graflo/db/arango/bulk.py
import_params(collection)
¶
Query parameters of an import into collection.