Skip to main content

Module schema

Module schema 

Source
Expand description

A graph as a schema: <graph>.edges and <graph>.nodes.

Each graph registers a GraphSchema in the default catalog under its name. Its two tables are views (ViewTables) whose plans are built from the graph’s implied pair (PropertyGraph::default_pair: its edge table and the vertex table that edge table refers to) every time a query names them, so they always read the current contents of the tables (and files) the graph is defined over. A graph with several vertex or edge tables has no implied pair, and so no nodes or edges table: its element tables are session tables already, and MATCH reads across them.

  • edges is the edge table: every row and column, unchanged.
  • nodes is one row per node, the node id in a column named id:
    • without a vertex table, the distinct non-null endpoints (source and destination values) of the edges;
    • with one, every row of the vertex table (its key renamed to id, followed by its other columns), and nothing else: the vertex table defines the node set, as in SQL/PGQ and DuckPGQ, and an edge whose source or destination is not one of its keys is dropped by the algorithms (#311). When the key and the endpoints have different types (Int32 and Int64, Utf8 and a dictionary), id has their common type, a dictionary as its values.

The plan builders (edges_plan, nodes_plan and their _from variants, which take table sources already resolved) are public so the graph algorithms can reuse them.

When a table under the graph cannot be read (it was deregistered through the DataFusion API, say), edges and nodes are still listed, with the columns they last had, and fail with the reason when a query reads them. Session listings (SHOW TABLES, information_schema) look every table up, so an error here would break them for the whole session.

Structs§

GraphSchema
The schema of one graph: its edges and nodes tables.

Constants§

EDGES
The name of a graph’s edge table in its schema.
ID
The node id column of <graph>.nodes.
NODES
The name of a graph’s node table in its schema.

Functions§

edges_plan
The plan of <graph>.edges: a scan of the edge table, as it is now.
edges_plan_from
edges_plan, with the edge table’s source already resolved.
graph_table
The table table names for the graph called graph: one the graph opened from a file path when it was created, or else the table or view in state.
lookup_table
The table provider table names in state, if there is one.
nodes_plan
The plan of <graph>.nodes (see the module docs).
nodes_plan_from
nodes_plan, with the tables’ sources already resolved. vertices must be given when the graph has a vertex table.
resolve_table
The table provider table names in state, or an error saying it does not exist.