<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nagabhushanam Gorantla on Medium]]></title>
        <description><![CDATA[Stories by Nagabhushanam Gorantla on Medium]]></description>
        <link>https://medium.com/@binaga.bhushan?source=rss-8d87f460be27------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Jhx4nXIxrAOTn6TMscG-sw.jpeg</url>
            <title>Stories by Nagabhushanam Gorantla on Medium</title>
            <link>https://medium.com/@binaga.bhushan?source=rss-8d87f460be27------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 16:07:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@binaga.bhushan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Designing Semantic Views for Reliable Snowflake Cortex Agents]]></title>
            <link>https://medium.com/@binaga.bhushan/designing-semantic-views-for-reliable-snowflake-cortex-agents-7dcde31be925?source=rss-8d87f460be27------2</link>
            <guid isPermaLink="false">https://medium.com/p/7dcde31be925</guid>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[snowflake-cortex]]></category>
            <category><![CDATA[semantic-layer]]></category>
            <dc:creator><![CDATA[Nagabhushanam Gorantla]]></dc:creator>
            <pubDate>Mon, 14 Sep 2026 13:08:58 GMT</pubDate>
            <atom:updated>2026-09-14T13:08:58.170Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A practical approach to choosing the right data source, preparing the right grain and keeping the semantic layer focused</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R0Pejr91_Yktho4NJz-XrA.png" /><figcaption><strong>Designing Semantic Views for Reliable Snowflake Cortex Agents</strong></figcaption></figure><p><em>A good semantic view starts before the semantic view itself.</em></p><p>Most organisations already have several data layers. These may include raw landing data, conformed models and consumption models created over time for reporting and analytics.</p><p>When building semantic views for Snowflake Cortex Agents, we do not need to follow one fixed path through those layers. The right starting point depends on the business question and the grain required to answer it.</p><p>The goal is simple:</p><p><em>Use the best available data source, prepare the required business grain where necessary, and keep the semantic view clear and focused.</em></p><p>This gives the Cortex Agent better context and makes answers easier to trace, validate and trust.</p><h3>Choose the source based on the business grain:</h3><p>A semantic view can reference physical objects from different areas of the data platform.</p><p>The source might be:</p><ul><li>Landed or curated source data</li><li>A conformed business model</li><li>An existing consumption model</li><li>A dedicated Snowflake view</li><li>An aggregated view</li><li>A dynamic table</li></ul><p>There is no value in rebuilding a model that already meets the business need.</p><p>If an existing consumption model already has the required grain, trusted business logic and suitable data quality, use it directly.</p><p>If the required grain does not exist, create a purpose-built foundation object first. This may be a dedicated view, an aggregated view or a dynamic table. Its purpose is to bring the relevant data together at the granularity required by the business question.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CzlogzkF1xxXyRU5dY1yTg.png" /><figcaption><strong>Choose the Source by Business Grain</strong></figcaption></figure><p>The decision is not based on a fixed data pipeline. It is based on whether the available data already supports the business question correctly.</p><h3>When a foundation object adds value:</h3><p>Snowflake supports physical tables and views directly within a semantic view. It also supports relationships between logical tables when those relationships are explicitly defined.</p><p>Direct semantic modelling can be a good option when the existing physical model already has:</p><ul><li>The correct grain</li><li>Clear keys and relationships</li><li>Trusted business definitions</li><li>Consistent classifications</li><li>Suitable query performance</li></ul><p>For more complex enterprise use cases, I prefer to create a purpose-built foundation object before building the semantic view.</p><p>The foundation object can handle:</p><ul><li>Joins across several sources</li><li>One-to-many relationships</li><li>Grain alignment</li><li>Aggregations</li><li>Business classifications</li><li>Derived indicators</li><li>Standard filters</li><li>Data quality rules</li><li>Reusable business calculations</li></ul><p>The semantic view then describes the prepared data in business language.</p><p>This does not mean relationships should never be defined inside semantic views. It means we should decide deliberately where the joins, relationships and business logic are best maintained.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D0BMy9PkdiPm9oltMXQuFQ.png" /><figcaption><strong>Two Valid Ways to Prepare Data for a Semantic View</strong></figcaption></figure><p>Both approaches are valid. The best choice is the simplest design that produces accurate, traceable and trusted answers.</p><h3>Start focused, then expand</h3><p>Snowflake recommends starting with approximately five to ten tables for an initial proof of concept.</p><p>The purpose of this guidance is not to create a permanent limit. It is to make the first implementation easier to understand, test and improve.</p><p>In a purpose-built foundation approach, the semantic view may reference regular views or dynamic tables rather than raw tables. I apply the same practical principle: begin with a small number of well-understood physical objects.</p><p>With a focused scope, it is easier to:</p><ul><li>Trace an answer back to its source</li><li>Confirm the grain of each logical table</li><li>Validate relationships</li><li>Improve business descriptions</li><li>Build representative verified queries</li><li>Investigate unexpected results</li><li>Measure routing and SQL accuracy</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xhWkBzJ5d2jFdtNHhYnEnw.png" /><figcaption><strong>Start Focused, Then Expand</strong></figcaption></figure><p>Expansion should be based on evidence. Before adding more physical objects, semantic views or agents, check routing accuracy, SQL accuracy, response time, security boundaries and business acceptance.</p><p>More data does not automatically produce a better agent.</p><h3>Treat the context window as a practical constraint</h3><p>Semantic view size is no longer only about counting physical objects or columns.</p><p>The semantic view definition, agent instructions and conversation history all consume the model’s context window.</p><p>Snowflake recommends keeping a semantic view under approximately 100,000 tokens. This is guidance rather than a fixed product limit. The effective boundary depends on the selected model, the size of the agent instructions and the length of the conversation.</p><p>When the combined context becomes too large, Cortex Agents may need to prune parts of the semantic view. This can add latency and reduce answer quality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pFon_WVjWDbXBtkSgL48Lw.png" /><figcaption><strong>The Context Window Is a Practical Constraint</strong></figcaption></figure><p><em>Proportions shown in this visual are illustrative. Snowflake’s approximately 100,000-token recommendation is guidance rather than a hard limit.</em></p><p>This is why focused semantic views remain valuable. The objective is not to make every semantic view as small as possible. The objective is to include enough business context to answer the intended questions without carrying large amounts of metadata that users are unlikely to need.</p><h3>Organise semantic views around business use cases</h3><p>A semantic view should represent a clear business area or question type.</p><p>Examples might include current operational status, historical events, financial transactions, contract terms, service performance or reconciliation outcomes.</p><p>The boundary should be based on business meaning, grain and intended questions. It should not be based only on where tables happen to be stored.</p><p>Clear boundaries also improve Cortex Agent routing.</p><p>Each semantic view should have a description that explains what business area it covers, what type of questions it answers, what grain it represents, when the agent should use it, and when the agent should use another tool.</p><p>Cortex Agents query separate semantic views independently. They do not join across separate semantic views. Closely related entities that must be analysed together should therefore be modelled within the same semantic view or prepared together in the foundation layer.</p><h3>How many semantic views should one agent use?</h3><p>There is no universal number that works for every agent.</p><p>An agent can work with many semantic views when the business areas are clearly separated and every semantic view has a distinct description.</p><p>The challenge is not simply the number of semantic views. The challenge is how easily the agent can identify the correct semantic view for each question.</p><p>For enterprise implementations, I prefer to begin with a smaller set of clearly separated semantic views and expand after evaluation confirms that routing remains accurate.</p><p>As a practical design checkpoint, I review whether a specialised second agent would be clearer when a single agent begins to cover many distinct business areas. This is a design judgement, not a Snowflake product limit.</p><p>The decision should be based on routing accuracy, description clarity, domain separation, evaluation results, security boundaries, end-to-end response time and user experience.</p><p>If descriptions begin to overlap, routing can become difficult even when the number of semantic views is relatively small.</p><h3>What improves accuracy</h3><p>A strong physical foundation is only the beginning. The semantic definition also needs careful attention.</p><h4>Business-focused descriptions</h4><p>Descriptions are one of the most important inputs for accuracy.</p><p>Describe logical tables, dimensions, metrics and filters in clear business language. Explain the business purpose, the grain, important inclusions and exclusions, expected usage, proprietary terms and legacy terminology.</p><p>A description should help the agent decide both when to use an object and when not to use it.</p><h4>Verified queries</h4><p>Verified queries pair real business questions with validated SQL.</p><p>They help Cortex Agents answer similar questions more accurately and can reduce latency. They should be added after the logical tables, columns, relationships and descriptions are sound.</p><p>Verified questions should come from business users, engineering SMEs, existing dashboards, repeated operational analysis and real usage patterns.</p><p>The same questions should also be included in an evaluation suite. That is what provides repeatable regression coverage when the semantic view, physical objects or agent instructions change.</p><h4>Metrics and filters</h4><p>Reusable metrics and filters provide consistent business definitions. They reduce the need for the agent to recreate important calculations and filtering rules for every question.</p><p>If a calculation represents an agreed business measure, define it once rather than expecting generated SQL to reconstruct it differently each time.</p><h4>Custom instructions</h4><p>Custom instructions can capture SQL generation rules, question categorisation, default behaviour, fiscal periods, business-specific conditions and scope boundaries.</p><p>Instructions should be clear, specific and tested after every meaningful change.</p><h4>Sample values and Cortex Search</h4><p>Representative sample values are useful for low-cardinality dimensions such as status, category or transaction type. They help the model understand the values that exist in the data.</p><p>For higher-cardinality text values, Cortex Search may provide better literal matching.</p><p>Synonyms should be used selectively for organisation-specific terminology, abbreviations and legacy names. Large automatically generated synonym lists may use valuable context without improving accuracy.</p><h3>Validate before expanding</h3><p>Before expanding a semantic view or attaching more tools to an agent, run a representative evaluation.</p><p>The evaluation should include direct lookups, aggregations, time-based questions, comparisons, business terminology, known edge cases, out-of-scope questions, and questions that could match more than one semantic view.</p><p>Validate the results with the relevant business and engineering SMEs.</p><p>If an SME has completed an analysis independently, the agent should produce the same result when given an equivalent question.</p><p>When results differ, check grain, scope, filters, relationships, business definitions, source selection, routing and verified query coverage.</p><p>This evidence provides a better basis for expansion than simply adding more available data.</p><h3>Key takeaways</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g_Mp2eb_xItZhfJm5zORIQ.png" /></figure><ul><li>Use the best existing data layer for the business question.</li><li>Use an existing model directly when it already contains the correct grain and trusted logic.</li><li>Create a purpose-built foundation object when preparation is still required.</li><li>Use views and dynamic tables to carry tested SQL logic.</li><li>Use semantic views to express clear business meaning.</li><li>Start with a focused scope and expand with evidence.</li><li>Protect the shared context window.</li><li>Use distinct semantic view descriptions to support routing.</li><li>Validate with real business questions before expanding.</li></ul><h3>Final thoughts</h3><p>The world has moved beyond requiring every new analytical experience to start from one prescribed enterprise model.</p><p>Raw, conformed and consumption layers can all provide value. The right source is the one that offers the most reliable path to the grain required by the business question.</p><p>The important part is the preparation decision.</p><p>If the required grain already exists, use it.</p><p>If it does not, create a purpose-built foundation object that settles the joins, relationships, classifications and business context before building the semantic view.</p><p>This keeps the semantic view focused, gives the Cortex Agent clearer context, and makes answers easier to trace and validate.</p><p>New platform capabilities give us more design options. Good architecture comes from choosing the simplest option that produces accurate, maintainable and trusted results.</p><h3>References</h3><ul><li><a href="https://docs.snowflake.com/en/user-guide/views-semantic/best-practices-modeling">https://docs.snowflake.com/en/user-guide/views-semantic/best-practices-modeling</a></li><li><a href="https://docs.snowflake.com/en/user-guide/views-semantic/overview">https://docs.snowflake.com/en/user-guide/views-semantic/overview</a></li><li><a href="https://docs.snowflake.com/en/user-guide/views-semantic/verified-query-repository">https://docs.snowflake.com/en/user-guide/views-semantic/verified-query-repository</a></li><li><a href="https://docs.snowflake.com/en/user-guide/dynamic-tables/overview">https://docs.snowflake.com/en/user-guide/dynamic-tables/overview</a></li><li><a href="https://docs.snowflake.com/en/user-guide/snowflake-cortex/snowflake-cowork">https://docs.snowflake.com/en/user-guide/snowflake-cortex/snowflake-cowork</a></li></ul><p><em>Based on practical experience designing Snowflake Cortex Agents and semantic views for use through Snowflake CoWork. All examples are generic and illustrative.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7dcde31be925" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Nine Design Decisions That Make Snowflake Cortex Agents Work]]></title>
            <link>https://medium.com/@binaga.bhushan/nine-design-decisions-that-make-snowflake-cortex-agents-work-fec9ee8393b4?source=rss-8d87f460be27------2</link>
            <guid isPermaLink="false">https://medium.com/p/fec9ee8393b4</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[snowflake-cortex]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[snowflake-cowork]]></category>
            <category><![CDATA[semantic-layer]]></category>
            <dc:creator><![CDATA[Nagabhushanam Gorantla]]></dc:creator>
            <pubDate>Tue, 08 Sep 2026 10:53:28 GMT</pubDate>
            <atom:updated>2026-09-08T10:53:28.853Z</atom:updated>
            <content:encoded><![CDATA[<p><em>What I’ve learned building agents business teams actually rely on</em></p><p>You can build a Snowflake Cortex Agent that demos well in an afternoon. Building one a business team actually relies on takes a lot longer and most of the hard part has nothing to do with the model.</p><p>It comes down to decisions you make early. How the layers are separated. How you scope your foundation views. How routing works. How you know the answers are right.</p><p>Get those wrong and you end up rebuilding. Here’s what I’d tell myself at the start.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gyrnqDnvEhndhzQfnKqt8Q.png" /></figure><h3>1. Give each layer one job</h3><p>Three layers sit between the raw data and the user.</p><p><strong>Foundation views and dynamic tables</strong> do the heavy SQL: the joins, the aggregations, the classification logic. <strong>Semantic views</strong> sit on top as a thin metadata layer that describes what the data means. <strong>The agent</strong> handles routing and guardrails.</p><p>The rule worth holding onto: foundation views do the work, semantic views describe it. Complex joins belong in the foundation layer, worked out once by someone who can test the result, rather than rebuilt by a model every time someone asks a question.</p><p>This also tells you where to look when something goes wrong. Nearly every issue I’ve traced sat in the foundation layer. Very few were solved by changing agent instructions.</p><h3>2. Start with the questions, not the schema</h3><p>Find out what people actually ask before you design anything. Production query logs are the best source, they show real patterns rather than what you assume people want. Talk to the SMEs to fill the gaps.</p><p>Query logs are also how you decide where the domain boundaries sit. On one build, analysing a year of query history showed two clear clusters of work and that split became two agents rather than one overloaded one. The data made that call, not a whiteboard.</p><p>Keep the question list. It becomes your evaluation set.</p><h3>3. Use several focused semantic views</h3><p>An agent should have several semantic views behind it, each covering one subject area. That’s the design, not a workaround.</p><p>The reason is disambiguation. Put current state, history, transactions and terms into a single broad view and the same question starts supporting two valid readings. Ask “how many open items” and it’s unclear whether you want a count today or a trend over months. Ask about “amount” and a contracted value looks identical to one that’s actually been paid.</p><p>That ambiguity is real, and it lives in the schema. Prompt engineering can’t resolve it. Splitting by subject area and letting the agent route between them can.</p><h3>4. Let grain decide whether you split or merge</h3><p>More views isn’t automatically better and this is the point I’d most want to pass on.</p><p>On one build, the proposal was separate views for SLA, reconciliation and volumes. All three sat at the same grain: one row per message. Merging them into a single view <em>improved</em> routing, because the agent no longer had to choose between three tools answering from identical data.</p><p>So the test isn’t how many views you have. It’s grain and purpose. Different grain and a different kind of question, split them. Same grain, merge them and let filters handle the rest.</p><p>Group by grain, not by convenience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NlRG_Ytn9vVn0dbGbEH_fw.png" /></figure><h3>5. Write the grain into every description</h3><p>Every table in a semantic view should say its grain in one sentence. One row per policy. One row per code and direction. One row per message.</p><p>If you can’t write that sentence, the design isn’t finished. And when someone later says the number doesn’t match their own analysis, grain is the first place to look.</p><h3>6. Keep tables independent inside the semantic view</h3><p>One table per logical entity and no relationships defined between them. The agent queries one table per tool call. If something needs a join, do it in the foundation layer first.</p><p>This keeps the metadata layer thin and predictable. It also means adding a new kind of question usually means adding a small view and a routing rule, rather than widening something that already works.</p><p>It makes debugging tractable too. When an answer looks wrong, you’re checking one table against one question, not unpicking a join the model made inside the metadata layer.</p><h3>7. Put the routing intelligence in the agent</h3><p>Once you have several views, the agent has to choose between them. Routing quality is what determines whether that works.</p><p>Short and specific beats long and careful. Keyword triggers for each tool, a clear decision tree, and a list of confusion pairs.</p><p>Confusion pairs are the terms that look identical in a schema but mean different things to a business user. “Entitled amount” is a contract term. “Amount paid” is a transaction. Any user knows the difference instantly, and the agent will treat them as interchangeable unless you say otherwise. Same with “how many”. With a timeframe it’s a trend question, without one it’s a snapshot. Different tool entirely.</p><h3>8. Treat verified queries as tests, not examples</h3><p>Verified queries are usually described as examples that help the agent learn. That’s true, but the more useful job they do is catching regressions.</p><p>Every change to a foundation view risks breaking an answer that used to work. Without verified queries, you find out when someone complains.</p><p>Two other habits matter nearly as much. Declare sample values on categorical columns, or the model will invent a status that doesn’t exist and return zero rows, which looks like a real answer. And put synonyms in the custom instructions, so people can ask in their own words.</p><h3>9. Validate against work an SME has already done</h3><p>This is the one that matters most. If an SME has done the analysis by hand and produced a number, the agent has to produce the same number. Exactly, not roughly.</p><p>That means establishing baselines before you deploy. And when numbers differ, tracing the cause rather than explaining it away. In my experience it’s nearly always grain, scope, or a filter with nothing to attach to.</p><p>Once a number checks out, turn it into a verified query and a scheduled health check. A one-off validation is worth far less than a test that fails when something moves.</p><h3>Key Takeaways</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gZHkeUbua9lLPUFoO-kHLQ.png" /></figure><ul><li><strong>Give each layer one job.</strong> Foundation views do the work, semantic views describe it, the agent routes.</li><li><strong>Start with the questions, not the schema.</strong> Query logs show you what people actually ask, and where the domain boundaries sit.</li><li><strong>Use several focused semantic views.</strong> One broad view leaves the same question with two valid readings.</li><li><strong>Let grain decide whether you split or merge.</strong> Not view count, not convenience.</li><li><strong>Write the grain into every table description.</strong> If you can’t say it in a sentence, the design isn’t finished.</li><li><strong>Keep tables independent inside the semantic view.</strong> Joins belong in the foundation layer.</li><li><strong>Put the routing intelligence in the agent.</strong> Keyword triggers, a decision tree and confusion pairs.</li><li><strong>Treat verified queries as regression tests.</strong> They catch breakage before users do.</li><li><strong>Validate against work an SME already did by hand.</strong> Exactly, not roughly.</li></ul><h3>The bigger model won’t save you</h3><p>Intelligence comes from context, not model size.</p><p>When an agent gives a bad answer, the instinct is to reach for a bigger model. Almost every time, the real fix is in the semantic view, the verified queries or the routing instructions. Pick the smallest model that clears your accuracy bar, pin it so it doesn’t change under you and put the effort into the layers below.</p><p>The model is the easy part.</p><p><em>Based on building Cortex Agents and semantic views on Snowflake, used through CoWork (formerly Snowflake Intelligence). Examples are illustrative.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fec9ee8393b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Data Lineage Explorer in Snowflake Using Streamlit]]></title>
            <link>https://medium.com/@binaga.bhushan/building-a-data-lineage-explorer-in-snowflake-using-streamlit-1870e354cf3a?source=rss-8d87f460be27------2</link>
            <guid isPermaLink="false">https://medium.com/p/1870e354cf3a</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[snowflake-data-cloud]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[data-lineage]]></category>
            <dc:creator><![CDATA[Nagabhushanam Gorantla]]></dc:creator>
            <pubDate>Sun, 06 Sep 2026 09:11:00 GMT</pubDate>
            <atom:updated>2026-09-06T09:21:21.807Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How I transformed Snowflake metadata into an interactive lineage experience using Streamlit, Snowpark and graph visualisation</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y4E4uBiCsDvkiiJ42rR-Og.png" /></figure><h3>Introduction</h3><p>One of the most common questions in any data platform is surprisingly difficult to answer:</p><p><em>If I change this table, what will break?</em></p><p>Data teams spend hours tracing dependencies, reading SQL, checking dashboards and messaging downstream consumers before making even a small change.</p><p>Here’s the thing: modern data platforms already contain most of the information needed to answer that question. Snowflake exposes it through ACCESS_HISTORY and OBJECT_DEPENDENCIES. The challenge isn&#39;t collecting the metadata, it&#39;s that raw metadata isn&#39;t useful to anyone.</p><p>So I built a Streamlit-in-Snowflake app that renders interactive lineage graphs, upstream and downstream, for any object in the data platform. This article walks through the approach. It’s generic and applies to almost any Snowflake environment.</p><h3>Why Data Lineage Matters</h3><p>As platforms grow, dependencies become increasingly difficult to manage.</p><p>A single table can feed:</p><ul><li>Reporting datasets</li><li>Dashboards</li><li>Machine learning models</li><li>Data products</li><li>Regulatory reporting</li><li>Downstream transformation pipelines</li></ul><p>Without lineage visibility, every change carries risk. The common challenges are always the same: understanding upstream dependencies, identifying downstream consumers, tracking sensitive data movement, assessing change impact and supporting governance initiatives.</p><p>The larger the platform becomes, the more valuable lineage becomes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*my6zceuXFlJFf5NGqQWOjg.png" /><figcaption>A single data asset often powers many business capabilities across the organisation.</figcaption></figure><h3>The Problem with Raw Metadata</h3><p>Snowflake already provides extensive metadata through system views. Two are particularly valuable.</p><p><strong>OBJECT_DEPENDENCIES</strong> provides object-level lineage between tables, views and materialised views.</p><p><strong>ACCESS_HISTORY</strong> provides activity-based metadata that can be used to derive column-level lineage.</p><p>The problem is that neither is user-friendly. A business analyst or data owner doesn’t want to inspect metadata tables and unpack nested JSON. They want answers to questions like:</p><p><em>What depends on this object?</em></p><p><em>Where does this metric originate?</em></p><p><em>What will be impacted if I make a change?</em></p><p>That’s where visualisation becomes important.</p><h3>Understanding Upstream and Downstream Lineage</h3><p>A lineage graph is essentially a dependency map. The selected object sits in the middle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J3JNkWpUjWvOt34dpKgu_Q.png" /><figcaption><em>A lineage graph is a dependency map, the selected object sits in the middle.</em></figcaption></figure><h3>Upstream lineage</h3><p>Upstream lineage answers: <em>What does this object depend on?</em></p><p>Typical upstream sources include source systems, dimensions, shared reference data and conformed datasets.</p><h3>Downstream lineage</h3><p>Downstream lineage answers: <em>What depends on this object?</em></p><p>Typical downstream consumers include reports, dashboards, analytics models and data products.</p><p>When visualised, these relationships become immediately understandable.</p><h3>Architecture Overview</h3><p>The application follows four simple layers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hUif5wDmaFsZ3abufS-ygA.png" /><figcaption>Four layers turn Snowflake metadata into an interactive lineage experience</figcaption></figure><p><strong>1. Snowflake metadata layer</strong> : OBJECT_DEPENDENCIES, ACCESS_HISTORY, QUERY_HISTORY and INFORMATION_SCHEMA hold the raw lineage signals.</p><p><strong>2. Processing layer: </strong>Snowpark Python executes the lineage queries, resolves dependencies, builds graph relationships and prepares the visualisation dataset.</p><p><strong>3. Visualisation layer: </strong>Relationships are converted into nodes and edges using Graphviz. Each object becomes a node; each dependency becomes an edge.</p><p><strong>4. User interface layer: </strong>Streamlit provides the exploration experience: select a database, browse schemas, choose an object, pick a direction and explore interactively.</p><p>This keeps the experience accessible even for non-technical users.</p><h3>Building the Core Lineage Query</h3><p>The foundation is OBJECT_DEPENDENCIES, it tells you what each view or table references.</p><p>The direction trips people up, so it’s worth stating plainly: REFERENCING_* is the object doing the depending, REFERENCED_* is the object being depended on. Filter on one to get the other.</p><pre>-- Upstream lineage: what does MY TABLE depend on?<br>-- Filter on REFERENCING = our object to find what IT references<br>SELECT<br>    REFERENCING_DATABASE || &#39;.&#39; || REFERENCING_SCHEMA || &#39;.&#39; || REFERENCING_OBJECT_NAME<br>      AS THIS_OBJECT,<br>    REFERENCING_OBJECT_DOMAIN AS THIS_OBJECT_TYPE,<br>    REFERENCED_DATABASE || &#39;.&#39; || REFERENCED_SCHEMA || &#39;.&#39; || REFERENCED_OBJECT_NAME<br>      AS DEPENDS_ON,<br>    REFERENCED_OBJECT_DOMAIN AS DEPENDS_ON_TYPE<br>FROM SNOWFLAKE.ACCOUNT_USAGE.OBJECT_DEPENDENCIES<br>WHERE REFERENCING_DATABASE = &#39;SOURCE_DB&#39;<br>  AND REFERENCING_SCHEMA = &#39;SCHEMA_NAME&#39;<br>  AND REFERENCING_OBJECT_NAME = &#39;MY TABLE&#39;<br>ORDER BY DEPENDS_ON;</pre><pre>-- Downstream lineage: what depends on MY TABLE?<br>-- Filter on REFERENCED = our object to find what references IT<br>SELECT<br>    REFERENCING_DATABASE || &#39;.&#39; || REFERENCING_SCHEMA || &#39;.&#39; || REFERENCING_OBJECT_NAME<br>      AS DEPENDENT_OBJECT,<br>    REFERENCING_OBJECT_DOMAIN AS DEPENDENT_TYPE,<br>    REFERENCED_DATABASE || &#39;.&#39; || REFERENCED_SCHEMA || &#39;.&#39; || REFERENCED_OBJECT_NAME<br>      AS SOURCE_OBJECT,<br>    REFERENCED_OBJECT_DOMAIN AS SOURCE_TYPE<br>FROM SNOWFLAKE.ACCOUNT_USAGE.OBJECT_DEPENDENCIES<br>WHERE REFERENCED_DATABASE = &#39;SOURCE_DB&#39;<br>  AND REFERENCED_SCHEMA = &#39;SCHEMA_NAME&#39;<br>  AND REFERENCED_OBJECT_NAME = &#39;MY TABLE&#39;<br>ORDER BY DEPENDENT_OBJECT;</pre><p>Together, these two queries create the basis of the lineage graph.</p><h3>Prerequisites</h3><p>Before the app will run, two things need to be in place.</p><p>ACCOUNT_USAGE isn&#39;t readable by default. Streamlit-in-Snowflake executes with owner&#39;s rights, so the grant goes to the app&#39;s owning role, not to the individual user:</p><pre>GRANT IMPORTED PRIVILEGES ON DATABASE SNOWFLAKE TO ROLE &lt;APP_OWNER_ROLE&gt;;</pre><p>The graphviz package is available through the Snowflake Anaconda channel but isn&#39;t loaded by default. Add it to the app&#39;s package list.</p><p>One more thing worth knowing: ACCOUNT_USAGE stores identifiers in uppercase, while SHOW commands return them as created. If your environment has mixed-case or quoted identifiers, equality filters will silently return zero rows.</p><h3>The Streamlit App Pattern</h3><p>The app itself is deliberately simple. Snowpark fetches the metadata, Graphviz renders the graph, and Streamlit handles navigation.</p><pre>import streamlit as st<br>from snowflake.snowpark.context import get_active_session<br>import graphviz<br><br>session = get_active_session()<br>st.title(&quot;Data Lineage Explorer&quot;)<br><br># Let the user pick a starting object<br>databases = session.sql(&quot;SHOW DATABASES&quot;).collect()<br>db_names = [row[&#39;name&#39;] for row in databases]<br>selected_db = st.selectbox(&quot;Database&quot;, db_names)<br><br>schemas = session.sql(f&quot;SHOW SCHEMAS IN DATABASE {selected_db}&quot;).collect()<br>schema_names = [row[&#39;name&#39;] for row in schemas]<br>selected_schema = st.selectbox(&quot;Schema&quot;, schema_names)<br><br># SHOW OBJECTS covers both tables and views - most lineage lives in views<br>objects = session.sql(<br>    f&quot;SHOW OBJECTS IN SCHEMA {selected_db}.{selected_schema}&quot;<br>).collect()<br>object_names = [row[&#39;name&#39;] for row in objects]<br>selected_object = st.selectbox(&quot;Table or View&quot;, object_names)<br><br>direction = st.radio(&quot;Direction&quot;, [&quot;Upstream&quot;, &quot;Downstream&quot;, &quot;Both&quot;])<br><br>if st.button(&quot;Show Lineage&quot;):<br>    fqn = f&quot;{selected_db}.{selected_schema}.{selected_object}&quot;<br>    upstream, downstream = [], []<br><br>    if direction in (&quot;Upstream&quot;, &quot;Both&quot;):<br>        upstream = session.sql(f&quot;&quot;&quot;<br>            SELECT REFERENCED_DATABASE || &#39;.&#39; || REFERENCED_SCHEMA || &#39;.&#39; ||<br>                   REFERENCED_OBJECT_NAME AS SOURCE_OBJ,<br>                   REFERENCING_DATABASE || &#39;.&#39; || REFERENCING_SCHEMA || &#39;.&#39; ||<br>                   REFERENCING_OBJECT_NAME AS TARGET_OBJ<br>            FROM SNOWFLAKE.ACCOUNT_USAGE.OBJECT_DEPENDENCIES<br>            WHERE REFERENCING_DATABASE = &#39;{selected_db}&#39;<br>              AND REFERENCING_SCHEMA = &#39;{selected_schema}&#39;<br>              AND REFERENCING_OBJECT_NAME = &#39;{selected_object}&#39;<br>        &quot;&quot;&quot;).collect()<br><br>    if direction in (&quot;Downstream&quot;, &quot;Both&quot;):<br>        downstream = session.sql(f&quot;&quot;&quot;<br>            SELECT REFERENCED_DATABASE || &#39;.&#39; || REFERENCED_SCHEMA || &#39;.&#39; ||<br>                   REFERENCED_OBJECT_NAME AS SOURCE_OBJ,<br>                   REFERENCING_DATABASE || &#39;.&#39; || REFERENCING_SCHEMA || &#39;.&#39; ||<br>                   REFERENCING_OBJECT_NAME AS TARGET_OBJ<br>            FROM SNOWFLAKE.ACCOUNT_USAGE.OBJECT_DEPENDENCIES<br>            WHERE REFERENCED_DATABASE = &#39;{selected_db}&#39;<br>              AND REFERENCED_SCHEMA = &#39;{selected_schema}&#39;<br>              AND REFERENCED_OBJECT_NAME = &#39;{selected_object}&#39;<br>        &quot;&quot;&quot;).collect()<br><br>    # Build graph<br>    dot = graphviz.Digraph(comment=&#39;Lineage&#39;)<br>    dot.attr(rankdir=&#39;LR&#39;)<br>    dot.attr(&#39;node&#39;, shape=&#39;box&#39;, style=&#39;rounded,filled&#39;, fillcolor=&#39;#1a1b26&#39;,<br>             fontcolor=&#39;#c0caf5&#39;, color=&#39;#7aa2f7&#39;)<br><br>    # Highlight the selected object<br>    dot.node(fqn, fqn, fillcolor=&#39;#7aa2f7&#39;, fontcolor=&#39;#0f1117&#39;)<br><br>    all_edges = []<br>    for row in upstream + downstream:<br>        all_edges.append((row[&#39;SOURCE_OBJ&#39;], row[&#39;TARGET_OBJ&#39;]))<br><br>    # Skip re-declaring the selected node - Graphviz merges repeated<br>    # node statements and would overwrite the highlight<br>    for src, tgt in all_edges:<br>        if src != fqn:<br>            dot.node(src, src)<br>        if tgt != fqn:<br>            dot.node(tgt, tgt)<br>        dot.edge(src, tgt)<br><br>    st.graphviz_chart(dot)<br>    st.write(f&quot;Found {len(all_edges)} lineage edges&quot;)</pre><p>Note the edges always flow referenced → referencing, regardless of which direction the user picked. That keeps the arrow semantics consistent: an arrow always points from source to consumer.</p><p>A caveat on the f-strings: this is fine for an internal tool where the values come from a controlled dropdown, but parameterise them if you extend this to accept free-text input.</p><p><strong>Deploying in Snowflake</strong></p><pre># snowflake.yml<br>definition_version: 2<br>entities:<br>  lineage_app:<br>    type: streamlit<br>    identifier:<br>      name: LINEAGE_EXPLORER<br>    title: &quot;Data Lineage Explorer&quot;<br>    main_file: lineage_app.py<br>    query_warehouse: ANALYTICS_WH<br>    pages_dir: pages/</pre><p>Check the manifest against your Snowflake CLI version, the schema for streamlit entities has shifted between releases and may also expect an artifacts list.</p><h3>Going Beyond Object Level Lineage:</h3><p>Object-level lineage is valuable, but many organisations eventually need column-level visibility, for tracking sensitive information, understanding metric derivation, supporting governance requirements or unpicking transformation logic.</p><p>For these use cases, ACCESS_HISTORY provides the detail. The important structural point is that column lineage is nested <em>inside</em> OBJECTS_MODIFIED: each modified column carries its own directSources array naming exactly where it came from. You don&#39;t join it against the accessed objects separately, doing that produces a cartesian product rather than lineage.</p><pre>-- Column-level lineage from ACCESS_HISTORY<br>-- Each modified column carries its own source list - no cross join needed<br>SELECT<br>    ah.QUERY_ID,<br>    qh.QUERY_TYPE,<br>    ah.QUERY_START_TIME,<br>    src.value:objectName::STRING     AS SOURCE_OBJECT,<br>    src.value:columnName::STRING     AS SOURCE_COLUMN,<br>    tgt_obj.value:objectName::STRING AS TARGET_OBJECT,<br>    tgt_col.value:columnName::STRING AS TARGET_COLUMN<br>FROM SNOWFLAKE.ACCOUNT_USAGE.ACCESS_HISTORY ah<br>JOIN SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY qh<br>    ON ah.QUERY_ID = qh.QUERY_ID<br>   AND qh.START_TIME &gt;= DATEADD(&#39;day&#39;, -30, CURRENT_TIMESTAMP())<br>, LATERAL FLATTEN(input =&gt; ah.OBJECTS_MODIFIED)         AS tgt_obj<br>, LATERAL FLATTEN(input =&gt; tgt_obj.value:columns)       AS tgt_col<br>, LATERAL FLATTEN(input =&gt; tgt_col.value:directSources) AS src<br>WHERE ah.QUERY_START_TIME &gt;= DATEADD(&#39;day&#39;, -30, CURRENT_TIMESTAMP())<br>  AND tgt_obj.value:objectName::STRING ILIKE &#39;%YOUR_TABLE%&#39;<br>ORDER BY ah.QUERY_START_TIME DESC<br>LIMIT 100;</pre><p>Two variants are worth knowing. directSources gives the immediate parent column one hop which preserves the chain view. baseSources skips intermediate views and returns the original base-table column. For a lineage explorer, directSources is usually the better default.</p><p>The date predicates appear on both sides deliberately: one prunes the ACCESS_HISTORY scan, the other prunes the join side. Without them this query gets expensive fast on a busy account.</p><h3>Impact Analysis: Seeing the Bigger Picture</h3><p>One of the most valuable uses of lineage is impact analysis. Imagine an engineer wants to modify a critical dimension table.</p><p>Without lineage, the consumers, dashboards and models are all unknown. With lineage, affected assets are immediately visible, risk can be assessed, stakeholders can be notified, and the change becomes safer.</p><p>Lineage transforms change management from guesswork into a measurable process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PsNHUA62kFnxJ4j6BCNWKg.png" /><figcaption>Lineage turns change management from guesswork into a measurable process. Figures shown are illustrative.</figcaption></figure><h3>Practical Extensions:</h3><p>Once a basic explorer exists, several enhancements become straightforward.</p><p><strong>Recursive lineage</strong> : Use a recursive CTE on OBJECT_DEPENDENCIES to trace N levels deep. Useful for dependency analysis, platform documentation and data product discovery.</p><p><strong>Freshness overlay: J</strong>oin with TABLE_STORAGE_METRICS.LAST_ALTERED and colour stale nodes red.</p><p><strong>Classification overlay: </strong>Combine lineage with governance tags to understand how sensitive data flows through the platform.</p><p><strong>Change impact scoring: </strong>Rank objects by downstream significance so highly connected assets get stronger change controls.</p><p><strong>Semantic view lineage: </strong>Snowflake supports GET_LINEAGE for semantic views and agents.</p><h3>A Note on Latency:</h3><p>OBJECT_DEPENDENCIES has up to three hours of latency. ACCESS_HISTORY has up to 45 minutes. For real-time lineage you&#39;d need to parse query logs, which is a much bigger project. For governance, documentation and impact analysis, the latency is fine.</p><h3>Lessons Learned:</h3><p><strong>Metadata already exists.</strong> Many organisations invest heavily in separate lineage tooling while already holding valuable metadata inside Snowflake.</p><p><strong>Visualisation changes everything.</strong> Users rarely want metadata tables. They want answers. Graphs provide immediate understanding.</p><p><strong>Governance benefits from accessibility.</strong> The easier lineage is to reach, the more often it gets used. When engineers and analysts can explore dependencies themselves, governance becomes part of daily operations rather than a separate activity.</p><h3>Key Takeaways:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ojf1DrCEVBza6bjFOh-ymw.png" /></figure><h3>Final Thoughts:</h3><p>Data lineage is often treated as a governance requirement. In practice it’s much more than that.</p><p>Good lineage visibility improves engineering productivity, reduces deployment risk, accelerates root cause analysis and increases trust in data.</p><p>The good news is that most of what you need already exists inside Snowflake. With a little metadata processing and visualisation, you can turn it into an experience that helps both technical and business users understand how data actually moves through the platform.</p><p><em>Runs as a Streamlit-in-Snowflake app. The </em><em>graphviz library is available through the Snowflake Anaconda channel , add it to your app&#39;s packages. For more complex graph layouts, consider pydot or networkx with a matplotlib export. Replace all database and schema names with your own.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1870e354cf3a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Snowflake Intelligence: Semantic Views vs Semantic Models, What Really Works (and Why)]]></title>
            <link>https://medium.com/@binaga.bhushan/snowflake-intelligence-semantic-views-vs-semantic-models-what-really-works-and-why-75ebe30925a3?source=rss-8d87f460be27------2</link>
            <guid isPermaLink="false">https://medium.com/p/75ebe30925a3</guid>
            <category><![CDATA[snowflake-intelligence]]></category>
            <category><![CDATA[semantic-layer]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[cortex-analyst]]></category>
            <category><![CDATA[natural-language-queries]]></category>
            <dc:creator><![CDATA[Nagabhushanam Gorantla]]></dc:creator>
            <pubDate>Fri, 28 Nov 2025 00:43:41 GMT</pubDate>
            <atom:updated>2025-11-28T00:43:41.302Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction: Why This Matters</h3><p>Business users often wait days for a simple report because they need an analyst to write SQL. This slows decision making and creates bottlenecks.</p><p>With <strong>Snowflake Intelligence</strong>, that’s changing. Imagine asking a question in plain English, “What’s our average order value this quarter?” And getting an accurate answer instantly. No SQL. No chasing analysts. Just governed, reliable insights.</p><p>Behind this magic is the <strong>semantic layer</strong>, the foundation that ensures natural language queries return correct results. In this article, I will break down the two ways to build that layer, <strong>Semantic Views</strong> and <strong>Semantic Models (YAML)</strong> and share best practices and lessons learned from real-world implementations. If you are planning to enable Snowflake Intelligence, this guide will help you start strong and avoid common pitfalls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iqG45Sm_srW3qKCo2Fbz0Q.png" /><figcaption><strong>High-Level Architecture of Snowflake Intelligence</strong></figcaption></figure><h3>What the semantic layer does?</h3><p>The semantic layer translates business terms into queryable structures, aligning how users speak (“average order value”, “current policies”) with how data is actually stored (tables, keys, columns, dates). Snowflake provides two complementary options:</p><ul><li><strong>Semantic Views,</strong> a <strong>native Snowflake object</strong> that defines logical tables, relationships, facts, dimensions, time attributes, filters and metrics. Queryable via the SEMANTIC_VIEW(…) construct in SQL and consumed by <strong>Cortex Analyst</strong>.</li><li><strong>Semantic Models (YAML), </strong>a <strong>specification</strong> you provide to <strong>Cortex Analyst</strong> that maps business terminology to the physical schema and allows <strong>Custom Instructions</strong> to steer natural language to SQL generation.</li></ul><p>Both can be edited via YAML and support Custom Instructions. The <strong>fundamental difference</strong>: Semantic Models can be built from external files ( generated by other applications), while Semantic Views are created natively in Snowflake.</p><h4>Semantic Views (native, validated, quick to query)</h4><ul><li><strong>Object type in Snowflake</strong>: Defined in SQL or via <strong>Snowsight</strong> wizard/AI generator, lives alongside your other database objects.</li><li><strong>Custom Instructions</strong>: You can add Question Categorisation (synonyms, intent) and SQL Generation rules ( rounding, “current data” logic) to improve natural-language to SQL accuracy.</li><li><strong>Query surface</strong>: Concise, governed semantic SQL using SEMANTIC_VIEW(…). Dimensions group results, metrics apply aggregation rules and joins follow relationships you defined.</li><li><strong>LLM accuracy</strong>: Cortex Analyst Routing Mode prioritises semantic SQL from the view- shorter, safer and consistent with governed definitions and falls back to standard SQL only when necessary.</li><li><strong>Validation</strong>: Snowflake enforces rules for keys, relationships and expressions this prevents malformed joins and <strong>Cartesian products</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g5LkZ9yoy-4omdLxcwDdYQ.png" /></figure><h4>Semantic Models (YAML) for Analyst (expressive NL guidance)</h4><ul><li>Fundamentally all the features are same as Semantic Views.</li><li><strong>Specification file</strong>: Defines logical tables, facts, dimensions, time attributes, filters and metrics supplied directly in a file via stage path.</li><li><strong>Custom Instructions</strong>: Same capability as views add synonyms, intent patterns, and SQL rules.</li><li><strong>Flexibility</strong>: Can be created outside Snowflake (, exported from other tools such as Tableau, dbt, PowerBI and etc.), then imported.</li><li><strong>Performance caveat</strong>: Efficiency depends on design quality, poorly optimised joins or conditions can degrade performance.</li></ul><h3>Semantic Views vs Semantic Models:</h3><h4>Semantic Views</h4><ul><li>Created natively in Snowflake using SQL or Snowsight Cortex Analyst wizard.</li><li>Queryable via SEMANTIC_VIEW(...) in SQL.</li><li>Fast time-to-value, supports iterative build and quick wins.</li><li>Supports YAML export/import and Custom Instructions.</li><li>High NL→SQL accuracy with Routing Mode.</li><li>Snowflake enforces validation rules for relationships, dimension, measures and metrics.</li><li>Optimised for performance as logic runs inside Snowflake.</li></ul><h4>Semantic Models</h4><ul><li>Defined in YAML, can be built from external files or generated by other applications.</li><li>Supports Custom Instructions for advanced NL guidance.</li><li>Can be converted into a Semantic View for Snowflake native validation.</li><li>Longer upfront design effort, efficiency depends on modeling quality.</li><li>Performance risk if joins and conditions aren’t optimised.</li></ul><h3>What works first and why</h3><p>From experience, teams see the fastest success by <strong>starting with Semantic Views</strong> and layering <strong>Cortex Analyst</strong> on top:</p><ul><li>You design semantics where the data lives, keep logic governed and query with semantic SQL immediately.</li><li>Analyst’s <strong>Routing Mode</strong> is designed to use your view’s governed joins/metrics first, producing more accurate SQL without needing long prompts or complex external rules.</li><li>When you hit nuanced natural language questions (“current revenue”, fiscal calendars, rounding), introduce <strong>Custom Instructions</strong> for clarity.</li></ul><h3>Best practices that actually help (and avoid pain later)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sfmZGHFApsUX-FxKPO4m7g.png" /></figure><h4>Build per subject area</h4><p>Start with a clear domain (e.g., Claims, Policy, Sales). Don’t drag in tables you don’t need. De-normalised tables/views are best suits for this.</p><h4>Limit object count to a manageable scope (≈ 365)</h4><p>Keep the combined number of <strong>dimensions, facts, metrics, time attributes, and filters</strong> under ~365. It keeps the surface discoverable for users and raises LLM accuracy because the context is tighter.</p><h4>Name for business</h4><p>Use business friendly names and aliases for metrics and dimensions. It prevents confusion and reduces “prompt engineering” needs.</p><h4>Define relationships carefully</h4><p>Declare with correct relationships between tables. That’s how you avoid <strong>Cartesian products</strong> and incorrect aggregations.</p><h4>Iterate in Semantic View Playground</h4><p>Use the <strong>wizard and AI-assisted generator</strong> to bootstrap from example SQL and query history. Ask real questions in Cortex <strong>Playground</strong>, look at suggested queries and refine them and validate them before publishing it.</p><h4>Use Custom Instructions for natural language control</h4><p>When “current” means a specific status flag or you need a default time window, write it in <strong>Custom Instructions</strong>. Also capture <strong>Question Categorization</strong>, synonyms and intent patterns to help Analyst land the right SQL.</p><h4>Publish “golden questions”</h4><p>Document the top 10 business questions your view answers perfectly. It sets expectations, prevents off-the-cuff misinterpretations and speeds adoption.</p><h4>Best practice for security and RBAC compliance</h4><p><strong>Always use Snowflake-hosted models for RBAC enforcement</strong></p><ul><li>Snowflake-hosted models respect RBAC and allow lists for model access.</li><li>If you choose external models like Open AI, RBAC for model access is not enforced by Snowflake (data RBAC still applies, but model governance happens outside Snowflake).</li><li>For enterprise grade security and compliance, stick to Snowflake-hosted models when building Snowflake Intelligence experiences.</li></ul><h4>Common pitfalls (and how to avoid them)</h4><ul><li><strong>Too many tables/views</strong> in one semantic view → keep the subject area tight avoid unnecessary joins.</li><li><strong>Vague metric names</strong> → use explicit, business-friendly names and document aggregation rules.</li><li><strong>No defaults for “time”</strong> → write defaults in <strong>Custom Instructions</strong> (“last 12 months”, fiscal year boundaries) to guide natural language.</li></ul><p>If you want Snowflake Intelligence to deliver <strong>trustworthy answers</strong> in natural language, focus on your <strong>semantic layer</strong>. <strong>Semantic Views</strong> will get you there fastest with native validation and governed logic.</p><p>Start small, iterate in Playground, document golden questions and grow your semantic surface area deliberately. That’s how you go from “cool demo” to <strong>real self‑service analytics</strong>.</p><h3>Closing Thoughts</h3><p>Semantic Views and Semantic Models share many capabilities, but the <strong>origin and workflow differ</strong>. Views are Snowflake-native, fast and validated. Models can come from external files, which adds flexibility but also complexity and performance risk. Start with views, iterate and only bring YAML when language needs explicit rules.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75ebe30925a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>