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.
edgesis the edge table: every row and column, unchanged.nodesis one row per node, the node id in a column namedid:- without a vertex table, the distinct non-null endpoints (
sourceanddestinationvalues) 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 (Int32andInt64,Utf8and a dictionary),idhas their common type, a dictionary as its values.
- without a vertex table, the distinct non-null endpoints (
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§
- Graph
Schema - The schema of one graph: its
edgesandnodestables.
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
tablenames for the graph calledgraph: one the graph opened from a file path when it was created, or else the table or view instate. - lookup_
table - The table provider
tablenames instate, 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.verticesmust be given when the graph has a vertex table.- resolve_
table - The table provider
tablenames instate, or an error saying it does not exist.