Skip to main content

Module graph_parse

Module graph_parse 

Source
Expand description

Typed parsing for the graph DSL (GRAPH ..., MATCH ...).

The handler layer historically parsed graph statements with upper.find("KEYWORD") substring matching, which collapsed when a node id, label, or property value shadowed a DSL keyword. This module is the structural replacement: a quote- and brace-aware tokeniser feeds a variant-building parser that produces a typed NodedbStatement. Every graph DSL command flows through here before reaching a pgwire handler, so the handlers never touch raw SQL again.

Values collected here are intentionally unvalidated — numeric bounds, absent-but-required fields, and engine-level caps are enforced at the pgwire boundary where the error response is formed. That keeps this module free of pgwire dependencies and out of the nodedbnodedb-sql dependency edge.

Functions§

try_parse
Entry point: returns Some when sql starts with a graph DSL keyword (GRAPH ..., MATCH ..., OPTIONAL MATCH ...), else None so the main DDL parser can continue trying other cases.