Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions dbml-homepage/docs/syntax/data-lineage.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Dep order_staging [color: #79AD51] {
raw_orders.amount -> stg_orders.revenue

note: 'Join orders with payments, compute revenue'
materialized: table
materialized: 'table'
query: '''
Transformation query
'''
Expand All @@ -71,7 +71,8 @@ Block settings:

- `note`: description of the transformation. Supports [multi-line strings](./language-basics.md#multi-line-string).
- `color`: lineage line color. See [Colors](./enrichment-visualization.md#colors).
- Any other key (e.g. `materialized`, `owner`) is a [custom property](./enrichment-visualization.md#custom-properties).
- Any other key (e.g. `materialized`, `owner`) is a [custom property](./enrichment-visualization.md#custom-properties). Its value must be one of the [property value types](./enrichment-visualization.md#property-value-types), so a text value must be quoted (`materialized: 'table'`, not `materialized: table`).
- A named Dep can also get properties from a [`Metadata Dep` block](./enrichment-visualization.md#metadata-block).

:::note
- All edges in a block must target the **same downstream table**, or columns of that table.
Expand Down
15 changes: 12 additions & 3 deletions dbml-homepage/docs/syntax/enrichment-visualization.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ A key with no value (`[owner]`) or a duplicate key (`[owner: "a", owner: "b"]`)

You can also declare custom properties separately from the element definition using a `Metadata` block. This is useful for keeping annotations in a dedicated section, or for adding properties to elements defined elsewhere (including across files).

The block targets an element by kind and name, using `Metadata <kind> <name>`, where `<kind>` is one of `Table`, `Column`, `TableGroup`, `Note` or `Ref`. `Dep` is not supported yet.
The block targets an element by kind and name, using `Metadata <kind> <name>`, where `<kind>` is one of `Table`, `Column`, `TableGroup`, `Note`, `Ref` or `Dep`.

Each field uses the `key: value` syntax with one of the [property value types](#property-value-types). A key cannot be repeated within the same block.

Expand Down Expand Up @@ -197,11 +197,20 @@ Metadata Ref user_posts {
owner: 'reporting'
critical: true
}

Dep posts_by_user: users.id -> posts.user_id

Metadata Dep posts_by_user {
owner: 'analytics'
color: #e67e22
}
```

:::note
- `Metadata Ref` targets a [named relationship](../docs.md#relationships--foreign-key-definitions) by its name. Unnamed refs cannot be targeted.
- A `Metadata Ref` block is only valid when the ref exists (it is defined in the same file, or both of the endpoint tables are imported).
- `Metadata Ref` targets a [named relationship](../docs.md#relationships--foreign-key-definitions) by its name, and `Metadata Dep` targets a [named dependency](./data-lineage.md) by its name. Unnamed refs and deps cannot be targeted.
- The name can be written as `name` or `schema.name`. A bare name means the `public` schema, so `Metadata Ref user_posts` and `Metadata Ref public.user_posts` are the same.
- A `Metadata Ref` or `Metadata Dep` block is only valid when the ref or dep exists (it is defined in the same file, or all of its endpoint tables are imported).
- `color` and `note` in a `Metadata Ref` or `Metadata Dep` block set the relationship's or dependency's color and note.
:::

### Property Value Types
Expand Down
Loading
Loading