Using the Cortex Analyst Semantic View Generator¶
The Cortex Analyst Semantic View Generator provides a graphical user interface (GUI) for creating and managing semantic views. This wizard guides you through the process of defining your business semantics, making it accessible to users who might not be familiar with SQL.
For more information about using the generator and managing semantic models in YAML, see the following topics:
Creating a semantic view¶
To use the Cortex Analyst Semantic View Generator to create a new semantic view:
In Snowsight, select AI & ML.
Find the Cortex Analyst tile, select Try. The Select a semantic model window opens.
Under Role and warehouse:
Select the role that should own the semantic view.
Select the warehouse that should be used for queries of that semantic view.
Under Select from, select Semantic Views.
From the menu that displays No Database selected, select the database and schema where you want to create the semantic view.
Select Create new. The Semantic View Generator wizard opens.
In the Description step in the wizard:
From Location to store, select the database and schema where the model should be stored, if you haven’t already selected a location.
In Name, enter a name for your semantic model.
You must specify a name that starts with a letter or underscore and that only contains letters, numbers, underscores, or dollar signs.
(Optional) In Description, describe the data that your semantic model makes available, and describe the types of questions that users can ask.
Select Next: Select tables.
In the Select tables step in the wizard:
In the Find tables and views tab, select the tables or views that contain the data that you want to use in your semantic view.
You must select at least one table or view.
For better performance, don’t select more than ten tables.
If you want see the list of tables and views that you selected, select the Selected tab.
Select Next: Select columns.
In the Select columns step in the wizard:
Select the columns to include in the model.
To select all columns in a table or view, select the table or view.
For better performance, don’t select more than 50 columns.
Select Create and Save.
The Cortex Analyst window opens, displaying the details about the semantic model that you created.
Under Logical tables:
Review the facts, dimensions, and metrics defined for each table or view.
Provide business-friendly names and descriptions.
Add any additional facts, dimensions, and metrics needed.
Under Relationships:
Confirm any relationships defined by the generator.
Modify relationship properties as needed.
Add any additional relationships needed.
If you made any changes to the semantic view, select Save in the upper-right corner of the Cortex Analyst window.
Editing a semantic view¶
To edit a semantic view:
In Snowsight, select AI & ML.
Find the Cortex Analyst tile, select Try. The Select a semantic model window opens.
Under Role and warehouse:
Select the role that owns the semantic view.
Select the warehouse used for queries of the semantic view.
Under Select from, select Semantic Views.
From the database menu, select the database and schema containing the semantic view that you want to edit.
Select the semantic view that you want to edit, and select Open.
Make changes to the semantic view. You can:
Modify descriptions and basic information.
Add or remove data sources.
Change column selections.
Update relationships.
Add, modify or remove facts, dimensions, and metrics.
If you plan to use Cortex Analyst with this view, consider the following:
Add sample queries to the Verified Queries section.
These are example queries that help Cortex Analyst understand how to use the semantic view.
Add queries that represent common use cases for your data.
Add synonyms for your tables, facts, dimensions, or metrics.
These are alternative terms that users might use in queries.
Synonyms help Cortex Analyst correctly interpret user questions.
Add custom instructions.
These provide additional context about how the data should be interpreted.
Include business rules or constraints that should be considered.
Select Save in the upper-right corner of the Cortex Analyst window.
Best practices for using the Cortex Analyst Semantic View Generator¶
Provide clear descriptions:
Use business terminology in all names and descriptions.
Make descriptions detailed enough for non-technical users to understand.
Include representative user questions:
Include questions that can help the model generator better understand your intent.
Include variations of how questions might be asked.
Review generated suggestions carefully:
Make sure the questions are relevant for the use case.
Make sure the suggested relationships match your business understanding.
Test with real questions:
After creating your semantic view, test it with actual business questions.
Refine your semantic view, based on how well the model supports these questions.
Iterate on developing the semantic view:
Start with a simple star schema.
Start with core tables and metrics, then expand. We suggest three tables to keep things simple.
Get feedback from business users, and refine your semantic view.
Troubleshooting¶
If your semantic view is not listed in the list of views in the Cortex Analyst Semantic View Generator, refresh the list of models (not the page itself).
If errors occur with the relationships in the semantic view, ensure that these relationships match the actual data structure.
If queries are slow, reduce the number of tables or columns.
If Cortex Analyst produces unexpected results when using your semantic view, review the facts, dimensions, and metrics in the semantic view.