graflo.db.cypher.union¶
Cypher upserts that union list fields with what a node or relationship holds.
The node statement unwinds $data, so one statement serves a chunk of
documents on Neo4j and FalkorDB alike; relationships take
:func:union_assignment through :func:~graflo.db.cypher.rel_merge.rel_upsert_clause.
Functions:¶
union_assignment(var, field, incoming)
¶
var.field = <stored members, then incoming ones>, deduplicated.
Members keep first-seen order; null members are dropped, since null IN
acc is never true and they would pile up. Serves nodes and relationships.
Source code in graflo/db/cypher/union.py
union_upsert_query(class_name, match_keys, union_fields)
¶
Merge nodes of class_name on match_keys, unioning union_fields.
Each row of $data carries the replaced properties under p and the
union ones under u (:func:union_upsert_rows), so n += row.p can
never overwrite a stored list. Members keep first-seen order, stored ones
first; null members are dropped, since null IN acc is never true and
they would pile up.
Source code in graflo/db/cypher/union.py
union_upsert_rows(docs, union_fields)
¶
docs split into the p and u maps :func:union_upsert_query reads.