Generate graph projection
generate_graph_projectionGenerates openCypher CREATE/MERGE statements to project relational tables into an Apache AGE property graph, converting rows to vertices and foreign keys to edges. Returns Cypher for review without execution.
Instructions
Generate openCypher CREATE/MERGE statements that project a relational schema into an Apache AGE property graph — rows become vertices (one label per table), foreign keys become edges. EMITS the Cypher for review; NEVER executes it (like generate_test_data). With row_limit=0 (default) it returns a schema-level template plan (one CREATE per label, one MERGE per edge type, $prop placeholders) reading only the catalog. With row_limit>0 it also emits concrete per-row statements (values escaped, NULLs omitted, capped at 1000 rows/table). Tables without a primary key still get node CREATEs but their edges are skipped (they can't be reliably MATCHed). NOTE: AGE materialises the data (this is a LOAD, not a virtual view); run the node statements before the edge statements; the projection is 1-hop faithful to the FK graph. Returns an object with available (AGE installed, advisory), schema, graph_name, row_limit, node_labels (list of label, source_table, key_columns, property_columns), edge_types (list of edge_type, from_label, to_label, from_key, to_key, fk_name), cypher_statements (generated, never executed), warnings, and detail.
Example: generate_graph_projection(schema='public', graph_name='g', row_limit=0)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema | Yes | ||
| tables | No | ||
| database | No | Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids. | |
| row_limit | No | ||
| graph_name | No | g |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| detail | Yes | ||
| schema | Yes | ||
| warnings | Yes | ||
| available | Yes | ||
| row_limit | Yes | ||
| edge_types | Yes | ||
| graph_name | Yes | ||
| node_labels | Yes | ||
| cypher_statements | Yes |