DDL reference Private Preview
When you deploy a context repository, CES compiles your YAML semantic model into engine-specific DDL and executes it on your account. You never write this DDL directly, CES generates it, but understanding the structure helps you debug deploy failures, grant access to end users, and verify what was created. Select your engine below.
- Snowflake Cortex Analyst
- Databricks Metric View
CES compiles your Snowflake semantic model YAML into a CREATE OR REPLACE SEMANTIC VIEW statement and executes it on your Snowflake account using the Atlan service role.
CREATE OR REPLACE SEMANTIC VIEW PROD_DB.ANALYTICS.SALES_PIPELINE
tables (
PROD_DB.SALES.OPPORTUNITIES as OPPORTUNITIES -- physical table mapped to logical alias
comment = 'Active and closed sales opportunities.',
PROD_DB.SALES.ACCOUNTS as ACCOUNTS
comment = 'Customer and prospect account records.'
)
facts (
OPPORTUNITIES.ANNUAL_RECURRING_REVENUE as TOTAL_ARR -- aggregate measure
comment = 'Sum of annual recurring revenue.',
OPPORTUNITIES.DEAL_SIZE as DEAL_COUNT -- fact from a different column
comment = 'Count of deals in the pipeline.'
)
dimensions (
OPPORTUNITIES.STAGE_NAME as STAGE_NAME -- categorical dimension
comment = 'Current stage in the sales cycle.',
OPPORTUNITIES.CLOSE_DATE as CLOSE_DATE -- time dimension
comment = 'Expected or actual close date.',
ACCOUNTS.REGION as REGION
comment = 'Geographic region of the account.'
)
relationships (
OPPORTUNITIES(ACCOUNT_ID) references ACCOUNTS(ACCOUNT_ID) -- join condition
with relationship type left join
);
Statement structure
| Clause | Required | Description |
|---|---|---|
CREATE OR REPLACE SEMANTIC VIEW | Yes | Creates or replaces the semantic view at the fully qualified path <database>.<schema>.<view_name>. CES derives the view name from your repository name. |
tables (...) | Yes | Maps one or more physical Snowflake tables to logical aliases. Each alias is referenced in facts, dimensions, and relationships. |
facts (...) | No | Aggregate measures compiled from your YAML metrics[]. Each fact maps a column to a logical name with an optional comment. |
dimensions (...) | No | Categorical and time attributes compiled from your YAML dimensions[] and time_dimensions[]. |
relationships (...) | No | Join definitions compiled from your YAML relationships[]. Omitted if your repository has only one table. |
tables clause
tables (
<database>.<schema>.<table> as <alias>
comment = '<description>'
)
| Element | Description |
|---|---|
<database>.<schema>.<table> | Fully qualified physical table path. Must match the base_table in your YAML. |
as <alias> | Logical alias used everywhere else in the DDL. Compiled from the name field on your YAML table. UPPER_SNAKE_CASE. |
comment | Compiled from description in the YAML. Truncated at 200 characters. |
facts clause
facts (
<alias>.<column> as <fact_name>
comment = '<description>'
)
| Element | Description |
|---|---|
<alias>.<column> | Table alias and physical column reference. Compiled from the expr field on the YAML metric. |
as <fact_name> | Logical name for the measure. Compiled from the name field on the YAML metric. UPPER_SNAKE_CASE. |
comment | Compiled from description in the YAML. Truncated at 200 characters. |
The DDL clause is named facts, while the YAML uses metrics. CES handles this translation automatically. Both terms refer to the same concept: aggregate measures your business cares about.
dimensions clause
dimensions (
<alias>.<column> as <dim_name>
comment = '<description>'
)
Both dimensions[] and time_dimensions[] from your YAML compile into the same dimensions clause in the DDL. Cortex Analyst distinguishes time dimensions from categorical ones based on the column's Snowflake data type (DATE or TIMESTAMP_TZ), not from a separate DDL clause.
| Element | Description |
|---|---|
<alias>.<column> | Table alias and physical column reference. Compiled from expr in the YAML. |
as <dim_name> | Logical name. Compiled from name in the YAML. UPPER_SNAKE_CASE. |
comment | Compiled from description in the YAML. Truncated at 200 characters. |
relationships clause
relationships (
<left_alias>(<left_col>) references <right_alias>(<right_col>)
with relationship type <join_type>
)
| Element | Description |
|---|---|
<left_alias>(<left_col>) | Left-hand table alias and join column. Compiled from left_table and relationship_columns[].left_column in the YAML. |
references <right_alias>(<right_col>) | Right-hand table alias and join column. Compiled from right_table and relationship_columns[].right_column. |
with relationship type <join_type> | Compiled from join_type in the YAML. Values: LEFT JOIN, INNER JOIN, FULL JOIN. Defaults to LEFT JOIN. |
Verify deployment
After CES runs the DDL, confirm the semantic view was created:
SHOW SEMANTIC VIEWS IN SCHEMA <database>.<schema>;
To inspect the view definition:
SELECT GET_DDL('SEMANTIC_VIEW', '<database>.<schema>.<view_name>');
Grant access to end users
Business users need explicit grants to query the semantic view through Cortex Analyst. Replace <consumer_role> with the Snowflake role assigned to your users.
-- Grant access to a specific semantic view
GRANT REFERENCES, SELECT ON SEMANTIC VIEW <database>.<schema>.<view_name>
TO ROLE <consumer_role>;
-- Grant access to all future semantic views in the schema
GRANT SELECT ON FUTURE SEMANTIC VIEWS IN SCHEMA <database>.<schema>
TO ROLE <consumer_role>;
GRANT REFERENCES ON FUTURE SEMANTIC VIEWS IN SCHEMA <database>.<schema>
TO ROLE <consumer_role>;
Update or replace
CES always uses CREATE OR REPLACE SEMANTIC VIEW. Re-deploying a certified repository replaces the existing view in Snowflake. End-user grants are preserved across replacements because grants apply to the view path, not the view definition.
CES compiles your repository into one Databricks AI/BI Metric View per table using the official CREATE OR REPLACE VIEW ... WITH METRICS LANGUAGE YAML AS $$...$$ syntax documented in Databricks Metric Views. The YAML body follows Databricks's Metric View schema.
CREATE OR REPLACE VIEW prod_catalog.analytics.sales_pipeline_opportunities
WITH METRICS LANGUAGE YAML
AS $$
version: 1.1
comment: "Active and closed sales opportunities."
source: prod_catalog.sales.opportunities -- three-part UC path: catalog.schema.table
filter: "IS_DELETED = FALSE" -- optional default WHERE predicate
dimensions:
- name: stage_name
expr: STAGE_NAME
comment: "Current stage in the sales cycle."
synonyms: ["stage", "pipeline stage"]
measures:
- name: total_arr
expr: "SUM(ANNUAL_RECURRING_REVENUE)" -- must contain an aggregate function
comment: "Sum of annual recurring revenue."
$$;
The WITH METRICS LANGUAGE YAML clause tells Databricks to parse the body as a Metric View. The view appears in Unity Catalog alongside regular views but is recognized as an AI/BI Metric View when referenced by a Genie Space.
Statement structure
| Element | Required | Description |
|---|---|---|
CREATE OR REPLACE VIEW <catalog>.<schema>.<name> | Yes | Creates or replaces the Metric View at the fully qualified Unity Catalog path. CES derives the name from your repository name and per-table alias. |
WITH METRICS LANGUAGE YAML | Yes | Declares this is an AI/BI Metric View. Required by Databricks Runtime 17.3+. |
AS $$ ... $$ | Yes | Opens and closes the dollar-quote block containing the YAML body. |
| Metric View YAML body | Yes | Your compiled semantic model. Required top-level fields: version: 1.1, source. See the YAML schema reference for the full field reference. |
Trailing ; | Yes | Terminates the statement. CES executes one Metric View DDL at a time. |
Dollar-quote rules
The $$ ... $$ block that wraps the YAML body imposes constraints on its contents:
| Pattern | Blocked | Reason |
|---|---|---|
$$ anywhere in the YAML | Yes | Terminates the DDL delimiter early |
; in filter or on values | Yes | Breaks statement parsing |
DDL keywords in filter (CREATE, DROP, ALTER) | Yes | Injection risk |
If CES validation rejects your content, rewrite the affected field as a simple boolean predicate without these patterns.
Verify deployment
After CES executes the DDL, confirm the view was created in Unity Catalog:
SHOW VIEWS IN SCHEMA <catalog>.<schema>;
To inspect the Metric View definition:
DESCRIBE EXTENDED <catalog>.<schema>.<view_name>;
The VIEW DEFINITION field in the output contains the full WITH METRICS LANGUAGE YAML AS $$...$$ DDL. You can also navigate to the view in the Databricks UI under Catalog > catalog > schema > view.
Grant access to end users
Business users need access to the Metric View and the Genie Space, per Databricks's Genie access requirements. Replace <consumer_group> with the Unity Catalog group or principal assigned to your users.
-- Grant navigation + SELECT on the Metric View
GRANT USE CATALOG ON CATALOG <catalog> TO <consumer_group>;
GRANT USE SCHEMA ON SCHEMA <catalog>.<schema> TO <consumer_group>;
GRANT SELECT ON VIEW <catalog>.<schema>.<view_name> TO <consumer_group>;
In the Databricks workspace UI, also grant CAN VIEW or CAN RUN on the Genie Space (Settings → Permissions). End users need consumer access or the Databricks SQL workspace entitlement. They don't need direct warehouse permissions, queries run under the space creator's embedded compute credentials.
Genie Space
CES also creates a Genie Space alongside the Metric View at deploy time. The Genie Space is pre-populated with your context repository's business context and connected to the Metric View. End users interact with the Genie Space, not the Metric View directly.
To verify the Genie Space was created, navigate to Genie in your Databricks workspace. The space name matches your context repository name.
Update or replace
CES always uses CREATE OR REPLACE VIEW. Re-deploying a certified repository replaces the existing Metric View. CES also updates the connected Genie Space to reflect the new definition.
See also
- YAML schema reference: the YAML fields that compile into this DDL
- Deploy to Snowflake: certify and push to Snowflake Cortex Analyst
- Deploy to Databricks: certify and push to Databricks Genie
- Snowflake engine flow
- Databricks engine flow