SYSTEM$READ_OSSIE_YAML_FROM_SEMANTIC_VIEW

functionnot supportedAI & MLpreview

docs.snowflake.com ↗

System functions

Reads an existing semantic view and returns its definition as an Apache Ossie (incubating) YAML document. Apache Ossie (incubating) is an open standard for representing semantic models that enables interoperability across AI and BI tools. This function converts the semantic view’s internal representation to Ossie format and returns the resulting YAML string. Snowflake-specific features that have no Ossie equivalent are preserved in vendor custom extensions so they survive a round-trip through external tools.

Syntax

SYSTEM$READ_OSSIE_YAML_FROM_SEMANTIC_VIEW( '<fully_qualified_semantic_view_name>' )

Parameters

NameRequiredDescription
'fully_qualified_semantic_view_name'requiredThe fully qualified name of an existing semantic view, in the form database_name.schema_name.semantic_view_name. If any part of the name contains special characters (spaces, mixed case), wrap each part in double quotes inside the single-quoted argument string. For example: '"my database"."my schema"."My Model"'.

Returns

On success, returns a VARCHAR containing the Ossie YAML document in the standard document wrapper format: If the semantic view doesn’t exist or the calling role lacks privileges, the function raises an exception with a descriptive error message.

Usage notes

Access control requirements

A role used to execute this SQL command must have at least one of the following privileges at a minimum: Privilege | Object | Notes SELECT or USAGE | Semantic view | Required to read the semantic view definition. Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema. For instructions on creating a custom role with a specified set of privileges, see Creating custom roles. For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.

Snowflake-to-Ossie mapping reference

Snowflake semantic view construct | Ossie construct | Notes tables | datasets | Each table becomes a dataset. tables[*].base_table (table ref) | datasets[*].source | Reconstructed as db.schema.table dotted name. tables[*].base_table (subquery) | datasets[*].source | Returned as the raw SQL definition string. tables[*].primary_key.columns | datasets[*].primary_key | List of column names. tables[*].unique_keys[*].columns | datasets[*].unique_keys | List of lists of column names. dimensions | fields with dimension (is_time: false) | Dimension marker added, is_time defaults to false. time_dimensions | fields with dimension.is_time: true | Dimension marker added with is_time set to true. facts | fields without dimension | No dimension marker on the field. metrics (model-level) | metrics | Preserved at the top level of the semantic model. relationships (EQUI only) | relationships | Only equi-join relationships are exported. Extension metadata (version, ai_context, custom_extensions) | Restored to top-level Ossie fields | Round-tripped from the write path’s stored extension properties. Every field and metric expression is emitted with a single SNOWFLAKE dialect entry: If the view was originally created from Ossie YAML that included an ANSI_SQL dialect, only the SNOWFLAKE expression is returned (since Snowflake stores a single resolved expression internally). Snowflake features that have no direct Ossie representation are serialized into a SNOWFLAKE vendor custom extension at the appropriate level. External tools can ignore these extensions or pass them through unchanged. Model-level SNOWFLAKE extension: Field | Included when max_staleness | Model has a staleness policy. custom_instructions | Model has AI instructions. module_custom_instructions | Model has module-level instructions. variables | Model defines variables. verified_queries | Model has verified query examples. tags | Model has tags. Dataset-level SNOWFLAKE extension: Field | Included when synonyms | Dataset has synonym names. metrics | Dataset has table-level metrics (not representable as Ossie global metrics). filters | Dataset has table-level filters. tags | Dataset has tags. constraints | Dataset has constraint definitions. Field-level SNOWFLAKE extension: Field | Applies to | Included when synonyms | Dimensions | Field has synonym names. tags | Dimensions | Field has tags. sample_values | Dimensions, TimeDimensions, Facts | Field has sample values. cortex_search_service | Dimensions | Field is backed by a Cortex Search service. is_enum | Dimensions | Field is marked as an enumeration. access_modifier | Facts | Field has a non-default access modifier. Metric-level SNOWFLAKE extension: Field | Included when synonyms | Metric has synonym names. access_modifier | Metric has a non-default access modifier. non_additive_dimensions | Metric specifies non-additive dimensions. additive_dimensions | Metric specifies additive dimensions. using_relationships | Metric declares relationship usage. tags | Metric has tags.

What is converted faithfully

The following survive a full round-trip (write Ossie YAML then read it back): - Model name, description, and version - Dataset names, descriptions, sources (qualified names and subqueries) - Primary keys and unique keys - All field names, descriptions, and expressions - Field classification (dimension vs. time_dimension vs. fact) - Equi-join relationships (name, from/to tables, column mappings) - Model-level metrics (name, description, expression) - ai_context at model, dataset, and field levels - custom_extensions from any vendor (DBT, SALESFORCE, DATABRICKS, COMMON, SNOWFLAKE)

What is lost or not converted

Ossie concept / Snowflake feature | Behavior | Reason Non-EQUI relationships (ASOF, RANGE) | Silently dropped from output. | Ossie spec only defines equi-join semantics. Field labels | Lost on round-trip. | The write path doesn’t persist the label property. Data types | Not included in output. | By design, Ossie fields carry expressions, not storage types. Multi-dialect expressions | Only SNOWFLAKE dialect returned. | Snowflake stores a single resolved expression. Table-level metrics | Moved to dataset custom_extensions. | Ossie only supports model-level metrics. Table-level filters | Moved to dataset custom_extensions. | No Ossie equivalent. Preserved for round-trip via extension.

See also