# Data Graph YAML Reference


> YAML schema reference for defining a Data Graph with the Rudder CLI — entities, events, and relationships.



This reference documents the YAML schema for defining a [Data Graph](https://www.rudderstack.com/docs/audiences/data-graph/) with the [Rudder CLI](https://www.rudderstack.com/docs/rudder-cli/). Use it alongside the CLI to author, version-control, and sync data graph definitions as code.

## File structure

A data graph YAML file has the following top-level structure:

```yaml
version: rudder/v1
kind: "data-graph"
metadata:
  name: "ecommerce-data-graph"
spec:
  id: "ecommerce-data-graph"
  account_id: "<warehouse-account-id>"
  models:
    - ...
```

### Top-level fields

| Field | Type | <div>Description</div> |
|---|---|---|
| `version` <br/> Required | String | Schema version. Use `rudder/v1`. |
| `kind` <br/> Required | String | Resource kind. Must be `data-graph`. |
| `metadata.name` <br/> Required | String | Human-readable name for the data graph |
| `spec.id` <br/> Required | String | Unique ID for the data graph. Used as its stable identifier across syncs. |
| `spec.account_id` <br/> Required | String | The ID of the warehouse account the data graph reads from. |
| `spec.models` <br/> Required | List | List of entity and event models that make up the data graph. See [Models](#models) for more information. |

## Models

The `spec.models` list contains all the entities and events the data graph exposes to the Audience Builder. Each model points at a warehouse table and optionally declares relationships to other models.

### Model fields

| Field | Type | <div>Description</div> |
| :--- | :--- | :--- |
| `id` <br/> Required | String | Unique ID for the model within this data graph. Used as the target of relationships (see [Relationships](#relationships)). |
| `display_name` <br/> Required | String | Name shown in the Audience Builder UI (for example, `Customers`, `Sales`). |
| `type` <br/> Required | String | Either `entity` (dimension-style table) or `event` (timestamped fact table). |
| `table` <br/> Required | String | Fully qualified warehouse table name, for example, `ECOMMERCE_DB.E_MART.DIM_CUSTOMERS`. |
| `description` | String | Human-readable description of the model. Shown as a tooltip in the builder. |
| `primary_id` <br/> Required | String | Column that uniquely identifies a row in the table. Required for entities, **Optional** for events. |
| `timestamp` <br/> Required | String | Column holding the event timestamp. Required when `type: event`. Used for time-window filtering in the Audience Builder. **Optional** for entities. |
| `relationships` <br/> Optional | List | List of relationships this model has to other models. See [Relationships](#relationships) for more information. |
| `columns` <br/> Optional | List | Per-column overrides that give warehouse columns a marketer-friendly alias (`display_name`) and an optional `description` (both surfaced in the Audience Builder), and a PII flag (`pii_mask`) that masks the column's values in the Data Graph preview. <br /><br />See [Column metadata](#column-metadata) for more information. |

### Entity vs. event

- **Entity**: A dimension-like table representing a business object (`Customers`, `Products`, `Stores`). Use `type: entity` and set `primary_id`.
- **Event**: A fact-like table where each row represents something that happened at a point in time (`Sales`, `Customer Interactions`, `Loyalty Points`). Use `type: event` and set `timestamp`. Events can be filtered with a time window in the Audience Builder.

## Relationships

Relationships connect two models so marketers can filter one model using conditions on related records (for example, "customers with 3 or more orders"). Relationships are declared on the **source** model under its `relationships` list.

### Relationship fields

| Field | Type | <div>Description</div> |
| :--- | :--- | :--- |
| `id` <br/> Required | String | Unique ID for the relationship within the source model. |
| `display_name` <br/> Required | String | Name shown in the Audience Builder UI (for example, `Has Sales`, `Belongs To Account`). |
| `cardinality` <br/> Required | String | One of `one-to-many`, `many-to-one`, or `one-to-one`. See [Current limitations](https://www.rudderstack.com/docs/audiences/data-graph/#current-limitations). |
| `target` <br/> Required | String | Reference to the target model in the form `#data-graph-model:<model-id>`. |
| `source_join_key` <br/> Required | String | Column on the source model used in the join. |
| `target_join_key` <br/> Required | String | Column on the target model used in the join. |

### Target reference format

Relationship targets use the `#data-graph-model:<model-id>` reference format, where `<model-id>` is the `id` of another model in the same data graph. For example:

```yaml
target: "#data-graph-model:sales"
```

## Column metadata

By default, the Audience Builder shows the raw warehouse column names (for example, `EMAIL_ADDRESS` or `CREATED_TS`). Use the optional `columns` block on a model to give specific columns a marketer-friendly **alias** (`display_name`) and an optional **description** — both surface when building audiences and expressions, making the underlying warehouse columns easier to read and choose. You can also flag a column as **PII** with `pii_mask: true` to mask its sample values in the Data Graph preview.

The `columns` block is **sparse** — list only the columns you want to override. Columns you don't list keep their raw warehouse names.

```yaml
models:
  - id: "customers"
    display_name: "Customers"
    type: "entity"
    table: "ECOMMERCE_DB.E_MART.DIM_CUSTOMERS"
    primary_id: "CUSTOMER_KEY"
    columns:
      - name: "EMAIL_ADDRESS"                         # Warehouse column name (must match the table).
        display_name: "Email"                         # Friendly name shown in the Audience Builder.
        description: "Primary contact email"
        pii_mask: true                                # Mask this column's values in the preview.
      - name: "CUSTOMER_KEY"
        display_name: "Customer ID"                   # Alias only — no description.
      - name: "LOYALTY_NOTES"
        description: "Free-form loyalty notes"        # Description only — no alias.
      - name: "SSN"
        pii_mask: true                                # PII only — no alias or description.
```

### Column fields

| Field | Type | <div>Description</div> |
| :--- | :--- | :--- |
| `name` <br/> Required | String | Warehouse column name — must match a column in the model's `table`. |
| `display_name` <br/> Conditional | String | Friendly name shown in the Audience Builder instead of the raw column name. Required unless `description` or `pii_mask` is set. <br /><br />Maximum 255 characters — should be case-insensitive and unique within the model. |
| `description` <br/> Conditional | String | Human-readable note shown alongside the column in the Audience Builder. Required unless `display_name` or `pii_mask` is set. <br /><br />Maximum 255 characters. |
| `pii_mask` <br/> Optional | Boolean | When `true`, marks the column as PII so its values are masked (`***`) in the Data Graph preview. Defaults to `false`. <br /><br />Marking a column as PII is an **Enterprise-only** capability — the server rejects `pii_mask: true` on other plans. |

Note that:

- Each `columns` entry must set at least one of `display_name`, `description`, or `pii_mask`. 
- To clear one field while keeping the others, omit it from the entry. 
- To remove all metadata for a column, drop its entry — the next `apply` clears it, since the `columns` block is the source of truth.
- In the Data Graph preview, `pii_mask` columns render as `***`. Users with the **PII rETL Data Access** permission (and Org Admins) can reveal the clear text.

## Complete example

The following example defines a small e-commerce data graph with two entities (`Customers`, `Accounts`), one event (`Sales`), and the relationships between them:

```yaml
version: rudder/v1
kind: "data-graph"
metadata:
  name: "ecommerce-data-graph"
spec:
  id: "ecommerce-data-graph"
  account_id: "<warehouse-account-id>" # RudderStack generates this ID when you connect a warehouse to your RudderStack workspace.
  models:
    # --- Customers (entity) ---
    - id: "customers"
      display_name: "Customers"
      type: "entity"
      table: "ECOMMERCE_DB.E_MART.DIM_CUSTOMERS"
      description: "Customers with demographics and loyalty info"
      primary_id: "CUSTOMER_KEY"
      columns:
        - name: "EMAIL_ADDRESS"
          display_name: "Email"
          description: "Primary contact email"
          pii_mask: true
        - name: "LOYALTY_TIER"
          display_name: "Loyalty Tier"
      relationships:
        - id: "customer-has-sales"
          display_name: "Has Sales"
          cardinality: "one-to-many"
          target: "#data-graph-model:sales"
          source_join_key: "CUSTOMER_KEY"
          target_join_key: "CUSTOMER_KEY"
        - id: "customer-belongs-to-account"
          display_name: "Belongs To Account"
          cardinality: "many-to-one"
          target: "#data-graph-model:accounts"
          source_join_key: "ACCOUNT_KEY"
          target_join_key: "ACCOUNT_KEY"

    # --- Accounts (entity) ---
    - id: "accounts"
      display_name: "Accounts"
      type: "entity"
      table: "ECOMMERCE_DB.E_MART.DIM_ACCOUNTS"
      description: "Customer account records for individual, household, and corporate grouping"
      primary_id: "ACCOUNT_KEY"

    # --- Sales (event) ---
    - id: "sales"
      display_name: "Sales"
      type: "event"
      table: "ECOMMERCE_DB.E_MART.FACT_SALES"
      description: "Sales transactions with amounts, status, and store/channel links"
      timestamp: "CREATED_AT"
```

## Validate the data graph

Validate your data graph YAML before syncing it to your workspace:

```bash
rudder-cli validate -l data-graph.yaml
```

This command returns validation errors and warnings if the YAML is invalid.

### Validation rules

<div class="vr-explorer vr-explorer--filtered" data-vr-explorer data-vr-instance="1">
<div class="vr-explorer__toolbar">
<div class="vr-explorer__toolbar-row">
<div class="vr-explorer__search-wrap">
<label class="vr-explorer__search-label" for="vr-rules-search-1">Search rules</label>
<input id="vr-rules-search-1" class="vr-explorer__search" type="search" placeholder="Search rules…" data-vr-search autocomplete="off">
</div>
<div class="vr-explorer__spec-wrap">
Spec version
<div class="vr-explorer__spec-toggle">
<button type="button" class="vr-explorer__spec-btn is-active" data-vr-spec="v1">v1</button>
<button type="button" class="vr-explorer__spec-btn" data-vr-spec="legacy">v0.1</button>
</div>
</div>
</div>
<div class="vr-explorer__toolbar-row vr-explorer__toolbar-row--filters">
<div class="vr-explorer__phase">
Filter by phase
<button type="button" class="vr-explorer__phase-btn is-active" data-vr-phase="all">All</button>
<button type="button" class="vr-explorer__phase-btn" data-vr-phase="syntactic">Syntactic</button>
<button type="button" class="vr-explorer__phase-btn" data-vr-phase="semantic">Semantic</button>
</div>
<p class="vr-explorer__count" data-vr-count data-vr-total="8">Showing <strong>8</strong> of 8 rules</p>
</div>
</div>
<div class="vr-explorer__rules"><div class="vr-rule" id="vr-rule-1-datagraph-data-graph-relationship-cardinality-valid-v1" data-vr-rule data-phase="semantic" data-spec-version="v1" data-section="filtered-1" data-search="datagraph/data-graph/relationship-cardinality-valid relationship cardinality must be valid for the source and target model types semantic">
<div class="vr-rule__head">
<h4 class="vr-rule__title">Relationship cardinality must be valid for the source and target model types</h4>
<div class="vr-rule__meta">
semantic
error</div>
<p class="vr-rule__id">Rule ID: <code>datagraph/data-graph/relationship-cardinality-valid</code></p>
</div><div class="vr-examples vr-examples--full-border">
<h4 class="vr-examples__heading">Examples</h4><nav>
<div class="nav nav-tabs vr-examples__tabs">
<a class="nav-item nav-link active vr-examples__tab vr-examples__tab--valid" id="nav-vr-tab-vr-rule-1-datagraph-data-graph-relationship-cardinality-valid-v1-valid" data-toggle="tab" href="#vr-tab-vr-rule-1-datagraph-data-graph-relationship-cardinality-valid-v1-valid">

✓
Valid (2 examples)

</a>
<a class="nav-item nav-link vr-examples__tab vr-examples__tab--invalid" id="nav-vr-tab-vr-rule-1-datagraph-data-graph-relationship-cardinality-valid-v1-invalid" data-toggle="tab" href="#vr-tab-vr-rule-1-datagraph-data-graph-relationship-cardinality-valid-v1-invalid">

✕
Invalid (3 examples)

</a>
</div>
</nav>
<div class="tab-content vr-examples__panels" id="nav-tab-content-vr-tab-vr-rule-1-datagraph-data-graph-relationship-cardinality-valid-v1">
<div class="tab-pane fade show active vr-examples__panel vr-examples__panel--valid" id="vr-tab-vr-rule-1-datagraph-data-graph-relationship-cardinality-valid-v1-valid"><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Entity-to-entity relationship with any cardinality is valid</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: user
      display_name: User
      type: entity
      table: db.schema.users
      primary_id: user_id
      relationships:
        - id: user-account
          display_name: User Account
          cardinality: one-to-one
          target: &#34;#data-graph-model:account&#34;
          source_join_key: account_id
          target_join_key: account_id
    - id: account
      display_name: Account
      type: entity
      table: db.schema.accounts
      primary_id: account_id</code></pre></div>
</div></div><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Event-to-entity relationship uses many-to-one cardinality</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: purchase
      display_name: Purchase
      type: event
      table: db.schema.purchases
      timestamp: purchased_at
      relationships:
        - id: purchase-user
          display_name: Purchase User
          cardinality: many-to-one
          target: &#34;#data-graph-model:user&#34;
          source_join_key: user_id
          target_join_key: user_id
    - id: user
      display_name: User
      type: entity
      table: db.schema.users
      primary_id: user_id</code></pre></div>
</div></div></div>
<div class="tab-pane fade vr-examples__panel vr-examples__panel--invalid" id="vr-tab-vr-rule-1-datagraph-data-graph-relationship-cardinality-valid-v1-invalid"><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Event models cannot connect to other event models</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: purchase
      display_name: Purchase
      type: event
      table: db.schema.purchases
      timestamp: purchased_at
      relationships:
        - id: purchase-click
          display_name: Purchase Click
          cardinality: many-to-one
          target: &#34;#data-graph-model:click&#34;
          source_join_key: session_id
          target_join_key: session_id
    - id: click
      display_name: Click
      type: event
      table: db.schema.clicks
      timestamp: clicked_at</code></pre></div>
</div><div class="vr-diagnostics">
<div class="vr-diagnostics__label">Diagnostics</div>
<ul class="vr-diagnostics__list"><li class="vr-diagnostics__item">
spec.yaml
<code class="vr-diagnostics__ref">/models/0/relationships/0/cardinality</code>
event models cannot be connected to other event models
</li></ul>
</div></div><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Event-to-entity relationship requires many-to-one cardinality</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: purchase
      display_name: Purchase
      type: event
      table: db.schema.purchases
      timestamp: purchased_at
      relationships:
        - id: purchase-user
          display_name: Purchase User
          cardinality: one-to-many
          target: &#34;#data-graph-model:user&#34;
          source_join_key: user_id
          target_join_key: user_id
    - id: user
      display_name: User
      type: entity
      table: db.schema.users
      primary_id: user_id</code></pre></div>
</div><div class="vr-diagnostics">
<div class="vr-diagnostics__label">Diagnostics</div>
<ul class="vr-diagnostics__list"><li class="vr-diagnostics__item">
spec.yaml
<code class="vr-diagnostics__ref">/models/0/relationships/0/cardinality</code>
must have cardinality &#39;many-to-one&#39;
</li></ul>
</div></div><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Entity-to-event relationship requires one-to-many cardinality</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: user
      display_name: User
      type: entity
      table: db.schema.users
      primary_id: user_id
      relationships:
        - id: user-purchase
          display_name: User Purchase
          cardinality: many-to-one
          target: &#34;#data-graph-model:purchase&#34;
          source_join_key: user_id
          target_join_key: user_id
    - id: purchase
      display_name: Purchase
      type: event
      table: db.schema.purchases
      timestamp: purchased_at</code></pre></div>
</div><div class="vr-diagnostics">
<div class="vr-diagnostics__label">Diagnostics</div>
<ul class="vr-diagnostics__list"><li class="vr-diagnostics__item">
spec.yaml
<code class="vr-diagnostics__ref">/models/0/relationships/0/cardinality</code>
must have cardinality &#39;one-to-many&#39;
</li></ul>
</div></div></div>
</div></div></div>
<div class="vr-rule" id="vr-rule-1-datagraph-data-graph-relationship-refs-valid-v1" data-vr-rule data-phase="semantic" data-spec-version="v1" data-section="filtered-1" data-search="datagraph/data-graph/relationship-refs-valid relationship target references must resolve to existing models semantic">
<div class="vr-rule__head">
<h4 class="vr-rule__title">Relationship target references must resolve to existing models</h4>
<div class="vr-rule__meta">
semantic
error</div>
<p class="vr-rule__id">Rule ID: <code>datagraph/data-graph/relationship-refs-valid</code></p>
</div><div class="vr-examples vr-examples--full-border">
<h4 class="vr-examples__heading">Examples</h4><nav>
<div class="nav nav-tabs vr-examples__tabs">
<a class="nav-item nav-link active vr-examples__tab vr-examples__tab--valid" id="nav-vr-tab-vr-rule-1-datagraph-data-graph-relationship-refs-valid-v1-valid" data-toggle="tab" href="#vr-tab-vr-rule-1-datagraph-data-graph-relationship-refs-valid-v1-valid">

✓
Valid

</a>
<a class="nav-item nav-link vr-examples__tab vr-examples__tab--invalid" id="nav-vr-tab-vr-rule-1-datagraph-data-graph-relationship-refs-valid-v1-invalid" data-toggle="tab" href="#vr-tab-vr-rule-1-datagraph-data-graph-relationship-refs-valid-v1-invalid">

✕
Invalid

</a>
</div>
</nav>
<div class="tab-content vr-examples__panels" id="nav-tab-content-vr-tab-vr-rule-1-datagraph-data-graph-relationship-refs-valid-v1">
<div class="tab-pane fade show active vr-examples__panel vr-examples__panel--valid" id="vr-tab-vr-rule-1-datagraph-data-graph-relationship-refs-valid-v1-valid"><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Relationship target references an existing model in the Data Graph</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: user
      display_name: User
      type: entity
      table: db.schema.users
      primary_id: user_id
      relationships:
        - id: user-account
          display_name: User Account
          cardinality: one-to-one
          target: &#34;#data-graph-model:account&#34;
          source_join_key: account_id
          target_join_key: account_id
    - id: account
      display_name: Account
      type: entity
      table: db.schema.accounts
      primary_id: account_id</code></pre></div>
</div></div></div>
<div class="tab-pane fade vr-examples__panel vr-examples__panel--invalid" id="vr-tab-vr-rule-1-datagraph-data-graph-relationship-refs-valid-v1-invalid"><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Relationship target references a missing model</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: user
      display_name: User
      type: entity
      table: db.schema.users
      primary_id: user_id
      relationships:
        - id: user-missing
          display_name: User Missing
          cardinality: one-to-one
          target: &#34;#data-graph-model:non-existent&#34;
          source_join_key: ref_id
          target_join_key: ref_id</code></pre></div>
</div><div class="vr-diagnostics">
<div class="vr-diagnostics__label">Diagnostics</div>
<ul class="vr-diagnostics__list"><li class="vr-diagnostics__item">
spec.yaml
<code class="vr-diagnostics__ref">/models/0/relationships/0/target</code>
does not exist
</li></ul>
</div></div></div>
</div></div></div>
<div class="vr-rule" id="vr-rule-1-datagraph-data-graph-relationship-unique-pair-v1" data-vr-rule data-phase="semantic" data-spec-version="v1" data-section="filtered-1" data-search="datagraph/data-graph/relationship-unique-pair at most one relationship is allowed per source-target model pair semantic">
<div class="vr-rule__head">
<h4 class="vr-rule__title">At most one relationship is allowed per source-target model pair</h4>
<div class="vr-rule__meta">
semantic
error</div>
<p class="vr-rule__id">Rule ID: <code>datagraph/data-graph/relationship-unique-pair</code></p>
</div><div class="vr-examples vr-examples--full-border">
<h4 class="vr-examples__heading">Examples</h4><nav>
<div class="nav nav-tabs vr-examples__tabs">
<a class="nav-item nav-link active vr-examples__tab vr-examples__tab--valid" id="nav-vr-tab-vr-rule-1-datagraph-data-graph-relationship-unique-pair-v1-valid" data-toggle="tab" href="#vr-tab-vr-rule-1-datagraph-data-graph-relationship-unique-pair-v1-valid">

✓
Valid (2 examples)

</a>
<a class="nav-item nav-link vr-examples__tab vr-examples__tab--invalid" id="nav-vr-tab-vr-rule-1-datagraph-data-graph-relationship-unique-pair-v1-invalid" data-toggle="tab" href="#vr-tab-vr-rule-1-datagraph-data-graph-relationship-unique-pair-v1-invalid">

✕
Invalid

</a>
</div>
</nav>
<div class="tab-content vr-examples__panels" id="nav-tab-content-vr-tab-vr-rule-1-datagraph-data-graph-relationship-unique-pair-v1">
<div class="tab-pane fade show active vr-examples__panel vr-examples__panel--valid" id="vr-tab-vr-rule-1-datagraph-data-graph-relationship-unique-pair-v1-valid"><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Multiple relationships from one model to different targets are allowed</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: user
      display_name: User
      type: entity
      table: db.schema.users
      primary_id: user_id
      relationships:
        - id: user-account
          display_name: User Account
          cardinality: one-to-one
          target: &#34;#data-graph-model:account&#34;
          source_join_key: account_id
          target_join_key: account_id
        - id: user-profile
          display_name: User Profile
          cardinality: one-to-one
          target: &#34;#data-graph-model:profile&#34;
          source_join_key: profile_id
          target_join_key: profile_id
    - id: account
      display_name: Account
      type: entity
      table: db.schema.accounts
      primary_id: account_id
    - id: profile
      display_name: Profile
      type: entity
      table: db.schema.profiles
      primary_id: profile_id</code></pre></div>
</div></div><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">A-to-B and B-to-A relationships are distinct and both allowed</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: user
      display_name: User
      type: entity
      table: db.schema.users
      primary_id: user_id
      relationships:
        - id: user-to-account
          display_name: User to Account
          cardinality: one-to-one
          target: &#34;#data-graph-model:account&#34;
          source_join_key: account_id
          target_join_key: account_id
    - id: account
      display_name: Account
      type: entity
      table: db.schema.accounts
      primary_id: account_id
      relationships:
        - id: account-to-user
          display_name: Account to User
          cardinality: one-to-one
          target: &#34;#data-graph-model:user&#34;
          source_join_key: account_id
          target_join_key: account_id</code></pre></div>
</div></div></div>
<div class="tab-pane fade vr-examples__panel vr-examples__panel--invalid" id="vr-tab-vr-rule-1-datagraph-data-graph-relationship-unique-pair-v1-invalid"><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Duplicate source-target model pairs are not allowed</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: user
      display_name: User
      type: entity
      table: db.schema.users
      primary_id: user_id
      relationships:
        - id: user-account-v1
          display_name: User Account v1
          cardinality: one-to-one
          target: &#34;#data-graph-model:account&#34;
          source_join_key: account_id
          target_join_key: account_id
        - id: user-account-v2
          display_name: User Account v2
          cardinality: one-to-many
          target: &#34;#data-graph-model:account&#34;
          source_join_key: account_id
          target_join_key: id
    - id: account
      display_name: Account
      type: entity
      table: db.schema.accounts
      primary_id: account_id</code></pre></div>
</div><div class="vr-diagnostics">
<div class="vr-diagnostics__label">Diagnostics</div>
<ul class="vr-diagnostics__list"><li class="vr-diagnostics__item">
spec.yaml
<code class="vr-diagnostics__ref">/models/0/relationships/0</code>
at most one relationship is allowed per source-target pair
</li><li class="vr-diagnostics__item">
spec.yaml
<code class="vr-diagnostics__ref">/models/0/relationships/1</code>
at most one relationship is allowed per source-target pair
</li></ul>
</div></div></div>
</div></div></div>
<div class="vr-rule" id="vr-rule-1-datagraph-data-graph-spec-syntax-valid-v1" data-vr-rule data-phase="syntactic" data-spec-version="v1" data-section="filtered-1" data-search="datagraph/data-graph/spec-syntax-valid data graph spec syntax must be valid syntactic">
<div class="vr-rule__head">
<h4 class="vr-rule__title">Data Graph spec syntax must be valid</h4>
<div class="vr-rule__meta">
syntactic
error</div>
<p class="vr-rule__id">Rule ID: <code>datagraph/data-graph/spec-syntax-valid</code></p>
</div><div class="vr-examples vr-examples--full-border">
<h4 class="vr-examples__heading">Examples</h4><nav>
<div class="nav nav-tabs vr-examples__tabs">
<a class="nav-item nav-link active vr-examples__tab vr-examples__tab--valid" id="nav-vr-tab-vr-rule-1-datagraph-data-graph-spec-syntax-valid-v1-valid" data-toggle="tab" href="#vr-tab-vr-rule-1-datagraph-data-graph-spec-syntax-valid-v1-valid">

✓
Valid

</a>
<a class="nav-item nav-link vr-examples__tab vr-examples__tab--invalid" id="nav-vr-tab-vr-rule-1-datagraph-data-graph-spec-syntax-valid-v1-invalid" data-toggle="tab" href="#vr-tab-vr-rule-1-datagraph-data-graph-spec-syntax-valid-v1-invalid">

✕
Invalid (4 examples)

</a>
</div>
</nav>
<div class="tab-content vr-examples__panels" id="nav-tab-content-vr-tab-vr-rule-1-datagraph-data-graph-spec-syntax-valid-v1">
<div class="tab-pane fade show active vr-examples__panel vr-examples__panel--valid" id="vr-tab-vr-rule-1-datagraph-data-graph-spec-syntax-valid-v1-valid"><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Valid Data Graph spec with entity and event models</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: user
      display_name: User
      type: entity
      table: db.schema.users
      primary_id: user_id
      root: true
    - id: purchase
      display_name: Purchase
      type: event
      table: db.schema.purchases
      timestamp: purchased_at
      relationships:
        - id: purchase-user
          display_name: Purchase User
          cardinality: many-to-one
          target: &#34;#data-graph-model:user&#34;
          source_join_key: user_id
          target_join_key: user_id</code></pre></div>
</div></div></div>
<div class="tab-pane fade vr-examples__panel vr-examples__panel--invalid" id="vr-tab-vr-rule-1-datagraph-data-graph-spec-syntax-valid-v1-invalid"><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Data Graph missing required account_id</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph</code></pre></div>
</div><div class="vr-diagnostics">
<div class="vr-diagnostics__label">Diagnostics</div>
<ul class="vr-diagnostics__list"><li class="vr-diagnostics__item">
spec.yaml
<code class="vr-diagnostics__ref">/account_id</code>
&#39;account_id&#39; is required
</li></ul>
</div></div><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Entity model missing required primary_id</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: user
      display_name: User
      type: entity
      table: db.schema.users</code></pre></div>
</div><div class="vr-diagnostics">
<div class="vr-diagnostics__label">Diagnostics</div>
<ul class="vr-diagnostics__list"><li class="vr-diagnostics__item">
spec.yaml
<code class="vr-diagnostics__ref">/models/0/primary_id</code>
&#39;primary_id&#39; is required for entity models
</li></ul>
</div></div><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Event model missing required timestamp</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: purchase
      display_name: Purchase
      type: event
      table: db.schema.purchases</code></pre></div>
</div><div class="vr-diagnostics">
<div class="vr-diagnostics__label">Diagnostics</div>
<ul class="vr-diagnostics__list"><li class="vr-diagnostics__item">
spec.yaml
<code class="vr-diagnostics__ref">/models/0/timestamp</code>
&#39;timestamp&#39; is required for event models
</li></ul>
</div></div><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Model table must use catalog.schema.table format</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: user
      display_name: User
      type: entity
      table: schema.users
      primary_id: user_id</code></pre></div>
</div><div class="vr-diagnostics">
<div class="vr-diagnostics__label">Diagnostics</div>
<ul class="vr-diagnostics__list"><li class="vr-diagnostics__item">
spec.yaml
<code class="vr-diagnostics__ref">/models/0/table</code>
&#39;table&#39; must be a 3-part reference in the format catalog.schema.table
</li></ul>
</div></div></div>
</div></div></div>
<div class="vr-rule" id="vr-rule-1-datagraph-data-graph-unique-names-valid-v1" data-vr-rule data-phase="semantic" data-spec-version="v1" data-section="filtered-1" data-search="datagraph/data-graph/unique-names-valid model and relationship names must be unique within a data graph semantic">
<div class="vr-rule__head">
<h4 class="vr-rule__title">Model and relationship names must be unique within a Data Graph</h4>
<div class="vr-rule__meta">
semantic
error</div>
<p class="vr-rule__id">Rule ID: <code>datagraph/data-graph/unique-names-valid</code></p>
</div><div class="vr-examples vr-examples--full-border">
<h4 class="vr-examples__heading">Examples</h4><nav>
<div class="nav nav-tabs vr-examples__tabs">
<a class="nav-item nav-link active vr-examples__tab vr-examples__tab--valid" id="nav-vr-tab-vr-rule-1-datagraph-data-graph-unique-names-valid-v1-valid" data-toggle="tab" href="#vr-tab-vr-rule-1-datagraph-data-graph-unique-names-valid-v1-valid">

✓
Valid

</a>
<a class="nav-item nav-link vr-examples__tab vr-examples__tab--invalid" id="nav-vr-tab-vr-rule-1-datagraph-data-graph-unique-names-valid-v1-invalid" data-toggle="tab" href="#vr-tab-vr-rule-1-datagraph-data-graph-unique-names-valid-v1-invalid">

✕
Invalid (2 examples)

</a>
</div>
</nav>
<div class="tab-content vr-examples__panels" id="nav-tab-content-vr-tab-vr-rule-1-datagraph-data-graph-unique-names-valid-v1">
<div class="tab-pane fade show active vr-examples__panel vr-examples__panel--valid" id="vr-tab-vr-rule-1-datagraph-data-graph-unique-names-valid-v1-valid"><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Unique model and relationship display names within the Data Graph</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: user
      display_name: User
      type: entity
      table: db.schema.users
      primary_id: user_id
      relationships:
        - id: user-order
          display_name: User Order
          cardinality: one-to-many
          target: &#34;#data-graph-model:order&#34;
          source_join_key: user_id
          target_join_key: user_id
    - id: order
      display_name: Order
      type: entity
      table: db.schema.orders
      primary_id: order_id</code></pre></div>
</div></div></div>
<div class="tab-pane fade vr-examples__panel vr-examples__panel--invalid" id="vr-tab-vr-rule-1-datagraph-data-graph-unique-names-valid-v1-invalid"><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Duplicate model display names within a Data Graph</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: user
      display_name: User
      type: entity
      table: db.schema.users
      primary_id: user_id
    - id: user-v2
      display_name: User
      type: entity
      table: db.schema.users_v2
      primary_id: user_id</code></pre></div>
</div><div class="vr-diagnostics">
<div class="vr-diagnostics__label">Diagnostics</div>
<ul class="vr-diagnostics__list"><li class="vr-diagnostics__item">
spec.yaml
<code class="vr-diagnostics__ref">/models/0/display_name</code>
duplicate model display name
</li><li class="vr-diagnostics__item">
spec.yaml
<code class="vr-diagnostics__ref">/models/1/display_name</code>
duplicate model display name
</li></ul>
</div></div><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Duplicate relationship display names within a Data Graph</h4><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: data-graph
metadata:
  name: my-data-graph
spec:
  id: my-data-graph
  account_id: wh-account-123
  models:
    - id: user
      display_name: User
      type: entity
      table: db.schema.users
      primary_id: user_id
      relationships:
        - id: user-order
          display_name: Links To
          cardinality: one-to-many
          target: &#34;#data-graph-model:order&#34;
          source_join_key: user_id
          target_join_key: user_id
    - id: order
      display_name: Order
      type: entity
      table: db.schema.orders
      primary_id: order_id
      relationships:
        - id: order-product
          display_name: Links To
          cardinality: one-to-many
          target: &#34;#data-graph-model:product&#34;
          source_join_key: order_id
          target_join_key: order_id
    - id: product
      display_name: Product
      type: entity
      table: db.schema.products
      primary_id: product_id</code></pre></div>
</div><div class="vr-diagnostics">
<div class="vr-diagnostics__label">Diagnostics</div>
<ul class="vr-diagnostics__list"><li class="vr-diagnostics__item">
spec.yaml
<code class="vr-diagnostics__ref">/models/0/relationships/0/display_name</code>
duplicate relationship display name
</li><li class="vr-diagnostics__item">
spec.yaml
<code class="vr-diagnostics__ref">/models/1/relationships/0/display_name</code>
duplicate relationship display name
</li></ul>
</div></div></div>
</div></div></div>
<div class="vr-rule" id="vr-rule-1-project-duplicate-urn-v1" data-vr-rule data-phase="syntactic" data-spec-version="v1" data-section="filtered-1" data-search="project/duplicate-urn urns must be unique across the project syntactic">
<div class="vr-rule__head">
<h4 class="vr-rule__title">URNs must be unique across the project</h4>
<div class="vr-rule__meta">
syntactic
error</div>
<p class="vr-rule__id">Rule ID: <code>project/duplicate-urn</code></p>
</div><div class="vr-examples vr-examples--full-border">
<h4 class="vr-examples__heading">Examples</h4><nav>
<div class="nav nav-tabs vr-examples__tabs">
<a class="nav-item nav-link active vr-examples__tab vr-examples__tab--valid" id="nav-vr-tab-vr-rule-1-project-duplicate-urn-v1-valid" data-toggle="tab" href="#vr-tab-vr-rule-1-project-duplicate-urn-v1-valid">

✓
Valid

</a>
<a class="nav-item nav-link vr-examples__tab vr-examples__tab--invalid" id="nav-vr-tab-vr-rule-1-project-duplicate-urn-v1-invalid" data-toggle="tab" href="#vr-tab-vr-rule-1-project-duplicate-urn-v1-invalid">

✕
Invalid

</a>
</div>
</nav>
<div class="tab-content vr-examples__panels" id="nav-tab-content-vr-tab-vr-rule-1-project-duplicate-urn-v1">
<div class="tab-pane fade show active vr-examples__panel vr-examples__panel--valid" id="vr-tab-vr-rule-1-project-duplicate-urn-v1-valid"><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Distinct URNs across files</h4><p class="vr-example__desc">Each spec declares a different resource, so URNs do not collide.</p><div class="rs-code">
<div class="rs-code__head">
a.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: events
metadata:
  name: events-a
spec:
  events:
    - id: order_completed
      name: Order Completed</code></pre></div>
</div><div class="rs-code">
<div class="rs-code__head">
b.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: events
metadata:
  name: events-b
spec:
  events:
    - id: cart_viewed
      name: Cart Viewed</code></pre></div>
</div></div></div>
<div class="tab-pane fade vr-examples__panel vr-examples__panel--invalid" id="vr-tab-vr-rule-1-project-duplicate-urn-v1-invalid"><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Same URN declared in two files</h4><p class="vr-example__desc">Both files declare the same event ID, which resolves to one URN. The rule flags each occurrence.</p><div class="rs-code">
<div class="rs-code__head">
a.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: events
metadata:
  name: events-a
spec:
  events:
    - id: order_completed
      name: Order Completed</code></pre></div>
</div><div class="rs-code">
<div class="rs-code__head">
b.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: events
metadata:
  name: events-b
spec:
  events:
    - id: order_completed
      name: Order Completed (duplicate)</code></pre></div>
</div><div class="vr-diagnostics">
<div class="vr-diagnostics__label">Diagnostics</div>
<ul class="vr-diagnostics__list"><li class="vr-diagnostics__item">
a.yaml
<code class="vr-diagnostics__ref">/spec/events/0/id</code>
duplicate URN &#39;event:order_completed&#39;
</li><li class="vr-diagnostics__item">
b.yaml
<code class="vr-diagnostics__ref">/spec/events/0/id</code>
duplicate URN &#39;event:order_completed&#39;
</li></ul>
</div></div></div>
</div></div></div>
<div class="vr-rule" id="vr-rule-1-project-manifest-inline-conflict-v1" data-vr-rule data-phase="syntactic" data-spec-version="v1" data-section="filtered-1" data-search="project/manifest-inline-conflict a (workspace_id, urn) must not be defined in both an import-manifest and inline metadata.import with differing remote_ids syntactic">
<div class="vr-rule__head">
<h4 class="vr-rule__title">A (workspace_id, urn) must not be defined in both an import-manifest and inline metadata.import with differing remote_ids</h4>
<div class="vr-rule__meta">
syntactic
error</div>
<p class="vr-rule__id">Rule ID: <code>project/manifest-inline-conflict</code></p>
</div><div class="vr-examples vr-examples--full-border">
<h4 class="vr-examples__heading">Examples</h4><nav>
<div class="nav nav-tabs vr-examples__tabs">
<a class="nav-item nav-link active vr-examples__tab vr-examples__tab--valid" id="nav-vr-tab-vr-rule-1-project-manifest-inline-conflict-v1-valid" data-toggle="tab" href="#vr-tab-vr-rule-1-project-manifest-inline-conflict-v1-valid">

✓
Valid

</a>
<a class="nav-item nav-link vr-examples__tab vr-examples__tab--invalid" id="nav-vr-tab-vr-rule-1-project-manifest-inline-conflict-v1-invalid" data-toggle="tab" href="#vr-tab-vr-rule-1-project-manifest-inline-conflict-v1-invalid">

✕
Invalid (2 examples)

</a>
</div>
</nav>
<div class="tab-content vr-examples__panels" id="nav-tab-content-vr-tab-vr-rule-1-project-manifest-inline-conflict-v1">
<div class="tab-pane fade show active vr-examples__panel vr-examples__panel--valid" id="vr-tab-vr-rule-1-project-manifest-inline-conflict-v1-valid"><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Manifest and inline metadata import distinct resources</h4><p class="vr-example__desc">One resource is imported via the manifest, a different one via inline metadata. No URN appears in both, so the project is valid.</p><div class="rs-code">
<div class="rs-code__head">
events.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: events
metadata:
  name: events
  import:
    workspaces:
      - workspace_id: &#34;ws-1&#34;
        resources:
          - urn: &#34;event:cart_viewed&#34;
            remote_id: &#34;remote_b&#34;
spec:
  events:
    - id: order_completed
      name: Order Completed
    - id: cart_viewed
      name: Cart Viewed</code></pre></div>
</div><div class="rs-code">
<div class="rs-code__head">
import-manifest.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: import-manifest
metadata:
  name: import-manifest
spec:
  workspaces:
    - workspace_id: &#34;ws-1&#34;
      resources:
        - urn: &#34;event:order_completed&#34;
          remote_id: &#34;remote_a&#34;</code></pre></div>
</div></div></div>
<div class="tab-pane fade vr-examples__panel vr-examples__panel--invalid" id="vr-tab-vr-rule-1-project-manifest-inline-conflict-v1-invalid"><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Same URN imported by both a manifest and inline metadata</h4><p class="vr-example__desc">The URN event:order_completed is declared in both the manifest and an inline metadata.import block — an ambiguous double import. The rule flags both locations; remove one.</p><div class="rs-code">
<div class="rs-code__head">
events.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: events
metadata:
  name: events
  import:
    workspaces:
      - workspace_id: &#34;ws-1&#34;
        resources:
          - urn: &#34;event:order_completed&#34;
            remote_id: &#34;remote_b&#34;
spec:
  events:
    - id: order_completed
      name: Order Completed</code></pre></div>
</div><div class="rs-code">
<div class="rs-code__head">
import-manifest.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: import-manifest
metadata:
  name: import-manifest
spec:
  workspaces:
    - workspace_id: &#34;ws-1&#34;
      resources:
        - urn: &#34;event:order_completed&#34;
          remote_id: &#34;remote_a&#34;</code></pre></div>
</div><div class="vr-diagnostics">
<div class="vr-diagnostics__label">Diagnostics</div>
<ul class="vr-diagnostics__list"><li class="vr-diagnostics__item">
import-manifest.yaml
<code class="vr-diagnostics__ref">/spec/workspaces/0/resources/0/urn</code>
URN &#39;event:order_completed&#39; is defined in both an import-manifest and inline metadata
</li><li class="vr-diagnostics__item">
events.yaml
<code class="vr-diagnostics__ref">/metadata/import/workspaces/0/resources/0/urn</code>
URN &#39;event:order_completed&#39; is defined in both an import-manifest and inline metadata
</li></ul>
</div></div><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Manifest URN overlaps a legacy rudder/0.1 inline local_id import</h4><p class="vr-example__desc">The events spec uses the legacy rudder/0.1 format, whose inline imports reference resources by local_id &#43; remote_id. The local_id order_completed resolves to the URN event:order_completed — the same URN the manifest imports. Legacy specs are still subject to the conflict rule, so both locations are flagged; remove the inline metadata entry.</p><div class="rs-code">
<div class="rs-code__head">
events.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/0.1
kind: events
metadata:
  name: events
  import:
    workspaces:
      - workspace_id: &#34;ws-1&#34;
        resources:
          - local_id: order_completed
            remote_id: &#34;remote_b&#34;
spec:
  events:
    - id: order_completed
      name: Order Completed</code></pre></div>
</div><div class="rs-code">
<div class="rs-code__head">
import-manifest.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: import-manifest
metadata:
  name: import-manifest
spec:
  workspaces:
    - workspace_id: &#34;ws-1&#34;
      resources:
        - urn: &#34;event:order_completed&#34;
          remote_id: &#34;remote_a&#34;</code></pre></div>
</div><div class="vr-diagnostics">
<div class="vr-diagnostics__label">Diagnostics</div>
<ul class="vr-diagnostics__list"><li class="vr-diagnostics__item">
import-manifest.yaml
<code class="vr-diagnostics__ref">/spec/workspaces/0/resources/0/urn</code>
URN &#39;event:order_completed&#39; is defined in both an import-manifest and inline metadata
</li><li class="vr-diagnostics__item">
events.yaml
<code class="vr-diagnostics__ref">/metadata/import/workspaces/0/resources/0/urn</code>
URN &#39;event:order_completed&#39; is defined in both an import-manifest and inline metadata
</li></ul>
</div></div></div>
</div></div></div>
<div class="vr-rule" id="vr-rule-1-project-metadata-syntax-valid-v1" data-vr-rule data-phase="syntactic" data-spec-version="v1" data-section="filtered-1" data-search="project/metadata-syntax-valid metadata syntax must be valid syntactic">
<div class="vr-rule__head">
<h4 class="vr-rule__title">Metadata syntax must be valid</h4>
<div class="vr-rule__meta">
syntactic
error</div>
<p class="vr-rule__id">Rule ID: <code>project/metadata-syntax-valid</code></p>
</div><div class="vr-examples vr-examples--full-border">
<h4 class="vr-examples__heading">Examples</h4><nav>
<div class="nav nav-tabs vr-examples__tabs">
<a class="nav-item nav-link active vr-examples__tab vr-examples__tab--valid" id="nav-vr-tab-vr-rule-1-project-metadata-syntax-valid-v1-valid" data-toggle="tab" href="#vr-tab-vr-rule-1-project-metadata-syntax-valid-v1-valid">

✓
Valid (2 examples)

</a>
<a class="nav-item nav-link vr-examples__tab vr-examples__tab--invalid" id="nav-vr-tab-vr-rule-1-project-metadata-syntax-valid-v1-invalid" data-toggle="tab" href="#vr-tab-vr-rule-1-project-metadata-syntax-valid-v1-invalid">

✕
Invalid (2 examples)

</a>
</div>
</nav>
<div class="tab-content vr-examples__panels" id="nav-tab-content-vr-tab-vr-rule-1-project-metadata-syntax-valid-v1">
<div class="tab-pane fade show active vr-examples__panel vr-examples__panel--valid" id="vr-tab-vr-rule-1-project-metadata-syntax-valid-v1-valid"><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Metadata with only the required name</h4><p class="vr-example__desc">Minimal valid metadata: a name only.</p><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: events
metadata:
  name: my-events
spec:
  events: []</code></pre></div>
</div></div><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Metadata with a well-formed import block</h4><p class="vr-example__desc">An import block where each workspace declares workspace_id and each resource references a URN in the spec body.</p><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: events
metadata:
  name: my-events
  import:
    workspaces:
      - workspace_id: ws-123
        resources:
          - urn: &#34;event:order_completed&#34;
            remote_id: ev-remote-456
spec:
  events:
    - id: order_completed
      name: Order Completed</code></pre></div>
</div></div></div>
<div class="tab-pane fade vr-examples__panel vr-examples__panel--invalid" id="vr-tab-vr-rule-1-project-metadata-syntax-valid-v1-invalid"><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Metadata missing required name</h4><p class="vr-example__desc">Every spec metadata block must declare a name.</p><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: events
metadata:
  import:
    workspaces:
      - workspace_id: ws-123
spec:
  events: []</code></pre></div>
</div><div class="vr-diagnostics">
<div class="vr-diagnostics__label">Diagnostics</div>
<ul class="vr-diagnostics__list"><li class="vr-diagnostics__item">
spec.yaml
<code class="vr-diagnostics__ref">/metadata/name</code>
&#39;name&#39; is required
</li></ul>
</div></div><div class="vr-example__item">
<h4 class="vr-examples__heading vr-examples__heading--example">Import workspace missing required workspace_id</h4><p class="vr-example__desc">Each import workspace entry must declare a workspace_id.</p><div class="rs-code">
<div class="rs-code__head">
spec.yaml
yaml
<button class="rs-code__copy" type="button">

Copy
</button>
</div>
<div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: events
metadata:
  name: my-events
  import:
    workspaces:
      - resources:
          - urn: &#34;event:order_completed&#34;
            remote_id: ev-remote-456
spec:
  events:
    - id: order_completed
      name: Order Completed</code></pre></div>
</div><div class="vr-diagnostics">
<div class="vr-diagnostics__label">Diagnostics</div>
<ul class="vr-diagnostics__list"><li class="vr-diagnostics__item">
spec.yaml
<code class="vr-diagnostics__ref">/metadata/import/workspaces/0/workspace_id</code>
&#39;workspace_id&#39; is required
</li></ul>
</div></div></div>
</div></div></div>
</div>
</div>

## Sync to your workspace

Once validation passes, sync the data graph to your workspace:

```bash
rudder-cli apply -l data-graph.yaml
```

## See also

- [Data Graph Overview](https://www.rudderstack.com/docs/audiences/data-graph/): Introduction to data graph and how it maps warehouse data for the Audience Builder
- [Rudder CLI Overview](https://www.rudderstack.com/docs/rudder-cli/): Rudder CLI overview and supported resources

