graflo.db.nebula.query¶
Query builders for NebulaGraph nGQL (v3.x) and ISO GQL (v5.x).
Each public function returns a query string ready to be passed to the
adapter's execute method.
Attributes¶
EdgeRow = tuple[str, str, int | None, dict[str, Any]]
module-attribute
¶
Classes¶
Functions:¶
aggregate_gql(tag_name, agg_func, discriminant=None, aggregated_field=None, filter_clause='')
¶
Source code in graflo/db/nebula/query.py
aggregate_ngql(tag_name, agg_func, discriminant=None, aggregated_field=None, filter_clause='')
¶
Build an aggregation query using MATCH.
Source code in graflo/db/nebula/query.py
batch_upsert_vertices_ngql(tag_name, docs, match_keys, tag_fields)
¶
Return a list of UPSERT VERTEX statements for a document batch.
Source code in graflo/db/nebula/query.py
create_edge_index_ngql(index_name, edge_type, index_fields, string_index_length=256)
¶
CREATE EDGE INDEX IF NOT EXISTS idx ON edge_type(field(len), ...).
Source code in graflo/db/nebula/query.py
create_edge_type_ngql(edge_type, fields=None)
¶
CREATE EDGE IF NOT EXISTS EdgeType(prop type, ...).
Source code in graflo/db/nebula/query.py
create_space_ngql(space_name, *, vid_type, partition_num, replica_factor)
¶
Source code in graflo/db/nebula/query.py
create_tag_index_ngql(index_name, tag_name, index_fields, string_index_length=256, string_fields=None)
¶
CREATE TAG INDEX IF NOT EXISTS idx ON tag(field(len), ...).
Source code in graflo/db/nebula/query.py
create_tag_ngql(tag_name, fields)
¶
CREATE TAG IF NOT EXISTS Tag(prop type, ...).
Source code in graflo/db/nebula/query.py
delete_edges_ngql(edge_type, src_vid, dst_vids)
¶
Delete every edge of edge_type from src_vid to any of dst_vids, at any rank.
Source code in graflo/db/nebula/query.py
drop_space_ngql(space_name)
¶
fetch_docs_gql(tag_name, filter_clause='', limit=None, return_keys=None)
¶
Source code in graflo/db/nebula/query.py
fetch_docs_ngql(tag_name, filter_clause='', limit=None, return_keys=None)
¶
MATCH (v:Tag) WHERE ... RETURN v LIMIT n.
Source code in graflo/db/nebula/query.py
fetch_edges_ngql(from_tag, from_vid, edge_type=None, to_tag=None, to_vid=None, filter_clause='', limit=None, direction=EdgeDirection.OUT, to_key=None)
¶
Build a GO query for fetching edges incident to one vertex.
$$ is the vertex at the far end of whichever orientation GO walked,
so the to_vid predicate keeps meaning "the other endpoint" under
REVERSELY and BIDIRECT without special-casing. to_key matches the
far end's VID without its tag, whatever tag it has.
Source code in graflo/db/nebula/query.py
fold_rows(rows)
¶
One row per key, in order of first occurrence; per field the latest value.
A field a later row lacks keeps its earlier value, as an upsert would.
Source code in graflo/db/nebula/query.py
insert_edges_ngql(edge_type, columns, edges, *, max_bytes, if_not_exists=False)
¶
INSERT EDGE type(cols) VALUES "src"->"dst"[@rank]:(vals), ….
Like :func:insert_vertices_ngql, an insert replaces the edge whole;
if_not_exists leaves an existing edge as it is instead.
Source code in graflo/db/nebula/query.py
insert_vertices_ngql(tag_name, columns, rows, *, max_bytes)
¶
INSERT VERTEX tag(cols) VALUES "vid":(vals), … for (vid, doc) rows.
Every column is written, a column the doc lacks as NULL: an insert
replaces the vertex's whole tag, so writing it again is harmless.
Source code in graflo/db/nebula/query.py
upsert_edge_ngql(edge_type, src_vid, dst_vid, props, edge_fields, rank=None)
¶
UPSERT EDGE ON type "src"->"dst"[@rank] SET prop=val, …; "" if none set.
Source code in graflo/db/nebula/query.py
upsert_vertex_gql(tag_name, vid, props, tag_fields)
¶
Source code in graflo/db/nebula/query.py
upsert_vertex_ngql(tag_name, vid, props, tag_fields)
¶
UPSERT VERTEX ON tag "vid" SET prop=val, ....