Semantic View Editor¶
The Semantic View Editor in Snowsight provides a visual interface for creating and editing Semantic Views. Whether you’re refining a view created by the Autopilot, building one from scratch, or editing an uploaded YAML specification, the editor helps you define business concepts, metrics, and relationships over your data.
The Semantic View Editor allows you to:
Define logical tables that map to your physical database tables
Create dimensions (categorical attributes), facts (row-level data), and metrics (aggregated measures)
Establish relationships between tables
Add verified queries as examples for Cortex Analyst
Provide custom instructions for query generation
Configure synonyms and descriptions to improve discoverability
Accessing the editor¶
You can access the Semantic View Editor through the data catalog or through Cortex Analyst.
Through the data catalog¶
To access an existing semantic view through the data catalog:
Sign in to Snowsight.
In the navigation menu, select Catalog » Database Explorer
Navigate to your database and schema.
Select Semantic Views in the object list.
Select the semantic view you want to edit.
Select the Semantic information tab to open the editor.
Through Cortex Analyst¶
To access semantic views through Cortex Analyst:
Sign in to Snowsight.
In the navigation menu, select AI & ML » Cortex Analyst.
Select the Semantic Views tab.
Either:
Select an existing view to edit it
Select Create new to create a new semantic view
Edit semantic view metadata¶
The semantic view name and description help users discover and understand the purpose of the view.
To edit the semantic view name or description:
In the editor, select Edit next to the semantic view name at the top of the page.
Update the Name or Description fields.
Select Save.
Tip
Write clear, detailed descriptions that explain:
What business questions this view can answer
What data sources it includes
Who should use this view
Example: “Revenue analysis across products and customers, including year-over-year trends. Use this view to analyze sales performance by region, product category, and customer segment.”
Manage logical tables¶
Logical tables represent business entities (such as customers, orders, or products) and map to physical database tables or views. Each semantic view contains one or more logical tables.
Add a logical table¶
To add a logical table to your semantic view:
In the editor, select + Logical Table.
Browse and select the physical table or view from your database.
Select Next.
Choose which columns to include from the table.
Select Generate logical table.
The editor automatically generates dimensions and facts based on the selected columns.
Edit a logical table¶
To modify an existing logical table:
Select Edit next to the table name (or select More options » Edit Logical Table).
Modify the table properties:
Name: The business-friendly name for this table
Description: Explanation of what this table represents
Synonyms: Alternative names (comma-separated)
Primary Key: Columns that uniquely identify rows
Select Save.
Tip
Use the Generate fields button to let AI automatically fill in descriptions and synonyms based on your data and column names. This can significantly speed up the initial setup process.
Managing facts, dimensions, and metrics¶
Within each logical table, you define the business concepts that users can query: dimensions, facts, and metrics.
Understanding the content types¶
Dimensions: Categorical attributes that provide context (such as, customer name, product category, or order date)
Facts: Row-level quantitative data (such as, sale amount, quantity, or unit price)
Metrics: Aggregated measures calculated from functions like SUM, AVG, or COUNT (such as, total revenue, average order value)
Adding dimensions, facts, or metrics¶
To add a new item to a logical table:
Navigate to the logical table in the editor.
Select + next to Dimensions, Facts, or Metrics.
Enter the required details:
Name: Descriptive name for this item
Expression: SQL expression to calculate the value
Data Type: The data type of the result
Select Add
Edit or remove items¶
To modify or delete an existing dimension, fact, or metric:
Select the item to open its details and edit properties.
Or select More options » Remove to delete the item.
Select Save to apply changes.
Advanced features¶
Derived Metrics: You can create view-level metrics that combine metrics from multiple tables. For more information, see Defining derived metrics.
Private Access Modifiers: Mark facts or metrics as private to hide them from queries while still using them in other calculations. For more information, see Marking a fact or metric as private.
Managing relationships¶
Relationships define how logical tables join together, enabling queries that span multiple tables. Each relationship defines which columns in one table reference columns in another table.
Adding a relationship¶
To create a relationship between two logical tables:
In the editor, select + next to Relationships.
Enter a descriptive Name for the relationship (for example, “orders_to_customers”).
Select the Left Table (the table with the foreign key).
Select the Right Table (the table being referenced).
Specify the Join Columns for each table:
Left Column: The foreign key column(s) in the left table
Right Column: The primary key or unique column(s) in the right table
Select Add.
The relationship now appears in the Relationships list and enables Cortex Analyst to generate queries that join these tables.
Note
For semantic views, you typically don’t need to specify join types (left outer, inner) or relationship types (one-to-one, many-to-one). These are automatically inferred from the data and primary key definitions at query time.
Editing or removing relationships¶
To modify or delete a relationship:
Select the relationship to view its details.
Edit the properties as needed, or select Remove to delete it.
Select Save to apply changes.
Advanced features for Cortex Analyst¶
To improve the accuracy and reliability of Cortex Analyst, you can add context and guidance through verified queries, synonyms, and custom instructions.
Verified queries¶
Verified queries provide example questions with their correct SQL answers. They serve two purposes:
Help Cortex Analyst understand how to answer similar questions
Provide suggested questions for users to get started
Adding a verified query:
Select + next to Verified Queries.
Enter a natural language Question (for example, “What are the top 10 products by revenue?”).
Enter the corresponding SQL Query that correctly answers the question.
(Optional) Check Use as onboarding question to show this as a suggestion to users.
Select Add.
Tip
Add verified queries for:
Common business questions users are likely to ask
Complex queries that require specific logic
Edge cases or unusual calculations
Questions that demonstrate the view’s capabilities
Synonyms¶
Note
Add synonyms manually rather than auto-generating them with AI. Focus on domain-specific alternatives like internal terminology, abbreviations, or legacy names. Auto-generated synonyms often reduce semantic view quality.
Synonyms help users discover and query your data using alternative terminology. For example, users might refer to “customers” as “clients” or “accounts.”
Adding synonyms to a table or field:
Navigate to the table, dimension, fact, or metric you want to add synonyms for.
Select Edit to open the item’s properties.
In the Synonyms field, enter alternative terms separated by commas.
Select Save.
Example synonyms:
For a “customer_name” dimension: “client name, account name, buyer name”
For a “revenue” metric: “sales, income, earnings”
For an “orders” table: “sales orders, purchases”
Custom instructions¶
Custom instructions provide specific guidance to Cortex Analyst for SQL generation and question categorization. Use custom instructions to:
Define business rules and constraints
Specify default behaviors
Handle ambiguous questions
Reject certain types of questions
Add a custom instruction by:
In the editor, select the Custom Instructions section.
Enter instructions in natural language. Examples:
“Always filter by active customers (status = ‘ACTIVE’) unless specified otherwise”
“Round all monetary values to 2 decimal places”
“When asked about revenue, use net_revenue metric unless gross revenue is explicitly requested”
“If a question asks about users without specifying a region, ask the user to clarify which region”
Select Save.
For more information about custom instructions on semantic views, see Providing custom instructions for Cortex Analyst.
Uploading a YAML file¶
If you have an existing semantic view YAML specification or a legacy semantic model YAML file, you can upload it to create a new semantic view or update an existing one.
To upload a YAML file:
In the navigation menu, select AI & ML » Cortex Analyst.
Select Create new » Upload YAML file.
Browse and select your YAML file.
Review the generated semantic view structure in the editor.
Select Convert and save to create the semantic view as a schema-level object.
The editor converts the YAML specification into a native Snowflake semantic view, which you can then edit using the visual interface.
For information about the YAML specification format, see YAML Specification for Semantic Views.
For information about converting a specification to a semantic view programmatically, see Creating a semantic view from a YAML specification.