Model a graph

Turn entities into nodes and links into directed relationships, then publish a version your team can query.

On this page

Define node and relationship keys

Choose a row identifier for each node label. Include tenant identity in the key when account IDs repeat across tenants. A relationship maps its source and destination columns to the full node keys in the same order.

In this mapping excerpt, Account rows come from PostgreSQL and Transfer rows come from Parquet. amount and event_time can be returned or filtered in queries.

YAML
nodes:
  Account:
    source: crm.public.accounts
    key: [tenant_id, account_id]
    properties: [status]
edges:
  Transfer:
    source: lake.finance.transfers
    key: [tenant_id, transfer_id]
    from: {node: Account, columns: [tenant_id, from_account_id]}
    to: {node: Account, columns: [tenant_id, to_account_id]}
    properties: [amount, event_time]

See the complete example for the source definitions and adapt its connection details to your data.

Save, validate, and publish

  1. Create a model in Graph Models (图模型), add data sources, and map the node labels and edge types.
  2. Save the draft and validate it. If validation flags a missing column, incompatible type, duplicate key, or unresolved endpoint, review the source table and key mapping.
  3. Publish the draft when it is ready, then use Query (查询) to run a small known-result query against the active revision.

Manage model revisions

Query traffic uses the published version while you edit a draft. With publication rights, use version history to compare revisions, activate a saved version through rollback, or take a model offline. A model rollback changes mappings. Take separate snapshots if you also need to restore source data.

For multi-table mappings, filters, and business-time rules, see the model reference.