semantic-view

Create, audit, debug, and evaluate Snowflake Cortex Analyst semantic views.

Updated Jun 9, 2025
One-click install
npx skills add https://github.com/RajaPoseidon/snippets_repo --skill semantic-view-rajaposeidon
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: semantic-view
Source: https://github.com/RajaPoseidon/snippets_repo/tree/main/snowflake/skills
Command: npx skills add https://github.com/RajaPoseidon/snippets_repo --skill semantic-view-rajaposeidon

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires snowflake-connector-python, pyyaml, sqlglot, tomli, urllib3, requests, and includes scripts (resource) and references (resource) components.

What problem does it solve? Building and maintaining Snowflake semantic views for Cortex Analyst involves tedious manual YAML authoring, guesswork about which metrics and verified queries users actually need, and slow trial-and-error debugging when natural-language questions generate wrong SQL. This Skill orchestrates the entire semantic view lifecycle so each step is guided, validated, and grounded in real usage data. ## Core Features & Use Cases - Creation & Import: Generate new semantic views via the FastGen system function from SQL queries and table metadata, or import Tableau (.twb/.twbx/.tds/.tdsx) and Power BI (.pbit/.pbix) files into semantic view YAML. - Suggestions & Enrichment: Mine Cortex Analyst usage and Snowflake query history to auto-suggest verified queries (VQRs), metrics, named filters, and computed facts. - Audit, Debug & Evaluate: Run behavioral VQR audits, targeted SQL-generation debug loops, apply 14 advanced modeling patterns (YoY, SCD2, semi-additive facts, funnels), and measure accuracy with native Analyst Evaluations (sql_correctness metric). - Use Case: After importing a Tableau workbook as a semantic view, seed it with VQR suggestions mined from query history, run an evaluation to establish a sql_correctness baseline, then debug failing questions and re-evaluate to confirm the fix without regressions. ## Quick Start Ask the assistant to create a semantic view from your SQL queries in a given database and schema, and it will run the mandatory setup before routing to the creation workflow.

Frequently Asked Questions about semantic-view

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Snowflake semantic view from SQL queries?▼

Provide your SQL queries, target database, and schema, and the creation workflow builds a FastGen request that calls SYSTEM$CORTEX_ANALYST_FAST_GENERATION. The generated YAML is validated with SYSTEM$CREATE_SEMANTIC_VIEW_FROM_YAML in verify-only mode before any deployment.

How do I import a Tableau or Power BI file into a semantic view?▼

Upload the .twb, .twbx, .tds, .tdsx, .pbit, or .pbix file to a Snowflake stage, then the import workflow analyzes it and exports semantic model YAML. Power BI DAX measures that cannot be transpiled are dropped and counted in the summary.

How do I generate verified query suggestions for a semantic view?▼

The VQR suggestions workflow runs a script that mines both Cortex Analyst request history and Snowflake query history in parallel, then merges results. Suggestions can be compile-checked with the SVA validation tool before being added to the view.

Can I measure SQL generation accuracy of a semantic view?▼

Yes, the evaluation workflow runs Snowflake's native Analyst Evaluations using the view's own verified queries as ground truth with the sql_correctness metric. Results show overall accuracy, per-query outcomes, and regressions in Snowsight.

Why does my semantic view query fail with a multi-path relationship error?▼

This happens when one fact table has two foreign keys to the same dimension without routing. The modeling patterns catalog provides fixes using one relationship per role plus using_relationships on each metric, with a diagnostic snippet mapping errors to root causes.

What are the prerequisites for running the semantic view workflows?▼

You need uv installed, Python packages managed via uv sync (snowflake-connector-python, pyyaml, sqlglot), and a Snowflake CLI config file with credentials. The setup step verifies all three checks before any workflow proceeds.