> ## Documentation Index
> Fetch the complete documentation index at: https://deepline.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Semantic-layer reference

> The stored YAML and query behavior implemented by the current warehouse connectors.

Deepline stores semantic-layer documents per org.
Connector update tools accept `yaml` or its `content` alias and optional `dryRun`.
Read tools return configuration state, content hash, update time, table names,
and optional YAML. See [Define warehouse metrics](https://deepline.com/docs/semantic-layer.md) for the procedure.

## Snowflake YAML

Snowflake updates check that the YAML is an object with a `tables` array, named
tables and physical references. Queries compile the stored model using a stricter
schema. Model-level `name` and `description`, table descriptions, and dimension,
time-dimension and fact data types receive defaults when omitted. Define exactly one dimension with
`main_id: true` across the model.

| Field | Query behavior |
| - | - |
| `tables[].name` | Logical table name selected by the semantic query. |
| `tables[].base_table` | Physical `table`, with optional `database` and `schema`. |
| `tables[].table` | Accepted by the update check, but not the query compiler. Use `base_table.table`. |
| `dimensions`, `time_dimensions`, `facts` | Named fields available as dimension/fact selections. |
| `metrics` | Named aggregate expressions; `expr` is required. |
| `filters` | Named predicates applied when selected; `expr` is required. |
| Field `name` | Field identifier; default expression for dimensions and facts when `expr` is omitted. |
| Field `expr`, `sql` | Use `expr` for SQL expressions. `sql` is not a supported field alias in the query compiler. |
| Field `synonyms` | Alternative field names for supported selections. |
| Field `data_type` | Declared field type; it does not inspect or coerce warehouse rows. |
| Field `description` | Descriptive metadata. |
| Dimension `main_id` | Marks the model identity; also supplies identity for legacy or inline funnel steps. |
| Dimension `unique` | Declares uniqueness for model and relationship validation; it does not check warehouse data. |
| Table `base_filter` | Automatically applied to queries of that table. |
| Model `relationships` | Join paths for referenced logical tables, using declared column mappings and join/cardinality types. |
| Model or table `funnel_events` | Event identity and step definitions used by funnel queries; model-level configuration takes precedence. |

A successful update does not establish that the model will compile, warehouse
objects exist, or declared identities and relationships match the data.

## Snowflake query behavior

`snowflake_run_semantic_query` reads the stored org model. It does not
accept an unsaved YAML override. Supply query selections inside `params`, or use
the retained top-level fields. When `params` is present, it owns those selections;
do not split them between the two forms.

Metrics queries select one logical `table_name` and named `metrics`, `dimensions`,
`facts` and `filters`. The renderer groups aggregates by selected dimensions or
facts, combines selected filters with `AND`, and plans joins for referenced
logical tables. `custom_dimensions` and `custom_filter_expressions` are also
rendered. Inspect the returned `sql` alongside rows and metadata.

A `type: "funnel"` query selects event steps from YAML definitions or supplies
inline `params.steps`. It uses event identity and timestamps, returns distinct-user
`conversions` per step, and supports `cohort_by`, `enforce_order` and
`time_window_days`. Ordering uses increasing per-user step timestamps; the time
window is measured from the first step. Check rendered SQL against known event
sequences before interpreting conversion rates.

See the [generated Snowflake query contract](https://deepline.com/docs/providers/snowflake/actions/run-semantic-query.md)
for accepted input fields. Schema acceptance alone does not establish warehouse
access or business correctness.

## Validation boundaries

Snowflake update validation checks YAML parsing, the `tables` array, table names,
and physical references. Its `dryRun` does not compile every expression or query
the warehouse. Query compilation can reject unsupported fields or invalid model
identities that the update check accepted.

Redshift updates require nonempty tables and `base_table.table`, then preflight a
query through the semantic compiler. Redshift queries use the shared renderer
with the Redshift dialect. This preflight still does not prove warehouse object
existence or metric correctness. Compare the
[Snowflake query](https://deepline.com/docs/providers/snowflake/actions/run-semantic-query.md) and
[Redshift query](https://deepline.com/docs/providers/redshift/actions/run-semantic-query.md) contracts before transferring a model.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.