graflo.db.bulk¶
The protocol a backend implements to load an empty target in bulk.
The caller folds the whole input first, so every vertex and every edge arrives
exactly once and a writer never looks for an existing element. Rows are in the
names the target stores. The order of calls is: bulk_begin, every vertex
chunk, bulk_prepare_edges, every edge chunk, bulk_finish. Chunks of one
phase may be written concurrently, each through its own connection, so a
writer keeps no state between calls beyond what the target holds. A writer
that declares bulk_partition_edges gets its edges in rounds: the chunks
written at once share no endpoint vertex.
A chunk with replay set may already be in the target (its commit was not
recorded); the writer must make writing it again harmless.
Attributes¶
StoredEdgeId = tuple[str, str | None, str]
module-attribute
¶
Classes¶
BulkCounts
¶
Bases: BaseModel
Elements the target holds after a load, per stored type.
Source code in graflo/db/bulk.py
BulkEdgeChunk
¶
Bases: BaseModel
Folded edges of one concrete relation, endpoints keyed on their identity.
Source code in graflo/db/bulk.py
Attributes¶
chunk_id
instance-attribute
¶
collection_name
instance-attribute
¶
dense = None
class-attribute
instance-attribute
¶
(source, target) dense ids, when the writer declares bulk_dense_ids.
match_keys_source
instance-attribute
¶
match_keys_target
instance-attribute
¶
merge_properties = []
class-attribute
instance-attribute
¶
Edge properties that, with the endpoints, tell parallel edges apart.
relation_name
instance-attribute
¶
replay = False
class-attribute
instance-attribute
¶
rows
instance-attribute
¶
source_class
instance-attribute
¶
stored_id
property
¶
target_class
instance-attribute
¶
BulkPlan
¶
Bases: BaseModel
What a writer asks of the load once it has begun.
Source code in graflo/db/bulk.py
Attributes¶
max_parallel = None
class-attribute
instance-attribute
¶
Chunks the target takes at once; the configured parallelism when None.
model_config = ConfigDict(frozen=True)
class-attribute
instance-attribute
¶
restart = False
class-attribute
instance-attribute
¶
On resume: the target lost every chunk written before, so all are written again.
BulkVertexChunk
¶
Bases: BaseModel
Folded vertices of one type.