<?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 Akshay Rajshekar Shiraguppi on Medium]]></title>
        <description><![CDATA[Stories by Akshay Rajshekar Shiraguppi on Medium]]></description>
        <link>https://medium.com/@akshayrs1993?source=rss-9c113069bbda------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BRFG18W3HNYOj-uYXdQHAg.jpeg</url>
            <title>Stories by Akshay Rajshekar Shiraguppi on Medium</title>
            <link>https://medium.com/@akshayrs1993?source=rss-9c113069bbda------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 20:19:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@akshayrs1993/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[How to Build an Effective Semantic Model/View in Snowflake❄️: Best Practices, DOs, and DON’Ts]]></title>
            <link>https://medium.com/snowflake/how-to-build-an-effective-semantic-model-view-in-snowflake-%EF%B8%8F-best-practices-dos-and-donts-f822bc1a4db4?source=rss-9c113069bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/f822bc1a4db4</guid>
            <category><![CDATA[cortex-analyst]]></category>
            <category><![CDATA[semantic-layer]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[conversational-analytics]]></category>
            <category><![CDATA[semantic-view]]></category>
            <dc:creator><![CDATA[Akshay Rajshekar Shiraguppi]]></dc:creator>
            <pubDate>Fri, 29 May 2026 16:22:41 GMT</pubDate>
            <atom:updated>2026-05-29T16:22:41.432Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uAu8xu6X3VFGEMMd3RVgAQ.png" /></figure><p>In the era of AI-powered analytics and self-service BI, a strong semantic layer is crucial. Snowflake’s Semantic Views let you define business-friendly concepts-entities, relationships, dimensions, and metrics directly in Snowflake. This powers tools like Cortex Analyst and ultimately Cortex Agents/Snowflake Intelligence for natural language querying while ensuring governance, consistency, and performance.</p><p>This guide walks you through building an effective semantic layer in Snowflake, with practical tips and hard earned DOs and DON’Ts.</p><h4>Why a Semantic View Matters in Snowflake?</h4><p>A Semantic View acts as a governed business interface over your raw tables or views. It defines:</p><ul><li>Logical tables <em>(business entities like Customers, Orders)</em></li><li>Relationships <em>(joins)</em></li><li>Dimensions <em>(attributes for slicing)</em></li><li>Metrics <em>(calculated measures like Total Revenue)</em></li><li>Cortex search<em> (to improve literal string searches)</em></li><li>Named filters <em>(saved condition to reuse in queries)</em></li><li>Verified queries <em>(example gold questions with correct answers that give the LLM an example of an accurate answer)</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PIcjwMVg5MsMVaN5-UZcug.png" /></figure><p>This bridges technical data models and business language, enabling accurate AI queries, consistent BI reporting, and reduced duplication of logic.</p><h4>Key Best Practices for Effectiveness</h4><p><strong>Design Principles</strong>:</p><ul><li><em>Think like your end users: Use business terminology, not technical column names.</em></li><li><em>Start small: Begin with 1 table or a focused domain (5–10 tables max for initial POC). Scale after validation.</em></li><li><em>Use a star schema foundation where possible for simplicity.</em></li><li><em>Place related objects in the same schema for easier privilege management.</em></li></ul><p><strong>Descriptions and Context</strong>:</p><ul><li><em>Write high-quality, detailed descriptions for tables, columns, metrics, and relationships. These directly feed the AI’s understanding.</em></li><li><em>Add synonyms (e.g., “Revenue” = “Sales Amount”) to handle natural language variations.</em></li></ul><p><strong>Metrics and Logic</strong>:</p><ul><li><em>Define precise metric expressions (e.g., SUM(order_amount) for Total Revenue).</em></li><li><em>Centralize calculations here to avoid inconsistencies downstream.</em></li></ul><p><strong>Version Control and Collaboration</strong>:</p><ul><li><em>Manage definitions with dbt packages (e.g., dbt_semantic_view) or YAML exports for Git.</em></li></ul><h3>DOs and DON’Ts</h3><h4><strong>DOs</strong>✅:</h4><ul><li>Start with single-table or simple views to learn the syntax and constraints.</li><li>Use consistent, boring, predictable alias names — creativity here causes issues.</li><li>Ensure unique, consistently named identifiers (e.g., always customer_id) across related tables.</li><li>Leverage Autopilot in Snowsight for faster bootstrapping from metadata or BI tools (e.g., Tableau twb file).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lCarwsnrxSiYQT0bqGl-Vg.png" /></figure><ul><li>Prioritize high-impact domains first (the 20% of data answering 80% of questions).</li><li>Secure with RBAC and monitor usage statistics (native to semantic views).</li><li>Iterate based on feedback and query logs.</li><li>Set up unit testing with “Verified Queries”.</li><li>Utilize the Tags to filter your data or to group your data.</li><li>Use the evaluations to identify issues and regressions in your semantic models.</li><li>Use the suggestion section to accelerate and improve development using AI.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*HL70LLe9HInOUrdc1yom-A.png" /></figure><h4><strong>DON’Ts</strong>❌:</h4><ul><li>Use generic or cryptic names for logical tables (e.g., avoid T_CUST_01); use business terms like customer.</li><li>Skip descriptions, poor metadata leads to inaccurate AI-generated SQL.</li><li>Ignore conflicts in multi-table setups; design relationships carefully.</li><li>Treat it as a one-time build; plan for ongoing maintenance and evolution.</li><li>Rely solely on semantic models (YAML); prefer semantic views for RBAC, stats, and integration benefits.</li></ul><h3>Conclusion:</h3><p>A well-built semantic view in Snowflake transforms your data platform from a raw repository into a business-ready intelligence layer. It reduces analyst toil, improves AI accuracy, and enforces a single source of truth.</p><p>Start simple, focus on business value, document relentlessly, and iterate. Your data consumers (and Cortex Analyst) will thank you.</p><p><strong>Next Steps</strong>:</p><ul><li>Explore Snowflake <a href="https://docs.snowflake.com/en/user-guide/views-semantic/overview">docs </a>on Semantic Views.</li><li>A strong foundation here could also power other tools/agents like ChatGPT, Copilot, etc. to connect to Snowflake data via MCPs (more on that next blog).</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f822bc1a4db4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/snowflake/how-to-build-an-effective-semantic-model-view-in-snowflake-%EF%B8%8F-best-practices-dos-and-donts-f822bc1a4db4">How to Build an Effective Semantic Model/View in Snowflake❄️: Best Practices, DOs, and DON’Ts</a> was originally published in <a href="https://medium.com/snowflake">Snowflake Builders Blog: Data Engineers, App Developers, AI, &amp; Data Science</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hash#️⃣ Functions in Snowflake❄️: The Fastest Way to Compare Massive Tables]]></title>
            <link>https://medium.com/snowflake/hash-%EF%B8%8F%E2%83%A3-functions-in-snowflake-%EF%B8%8F-the-fastest-way-to-compare-massive-tables-15122186d0b9?source=rss-9c113069bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/15122186d0b9</guid>
            <category><![CDATA[hash]]></category>
            <category><![CDATA[large-datasets]]></category>
            <category><![CDATA[tablet-comparison]]></category>
            <category><![CDATA[snowflake]]></category>
            <dc:creator><![CDATA[Akshay Rajshekar Shiraguppi]]></dc:creator>
            <pubDate>Tue, 16 Dec 2025 20:02:12 GMT</pubDate>
            <atom:updated>2025-12-16T20:02:12.704Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Stop comparing billions of rows one-by-one. Use HASH() instead***</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*hdxoQo70H78CIr-evjTV-Q.png" /></figure><p>If you’ve ever needed to verify that two huge tables in Snowflake are identical — whether for data validation, replication testing, ETL reconciliation, or migration cutover — you know the pain of row-by-row comparison. Even with a well-tuned query, joining two 100-billion-row tables on every column is slow, expensive, and sometimes simply times out.</p><p>Say, you’ve just loaded 500 million rows into a new table and need to prove fast and cheaply that it’s 100% identical to the old one. Stop writing monster FULL OUTER JOINs. Stop waiting hours for MINUS or EXCEPT to finish.</p><p>Just use HASH(*) + HASH_AGG(*) - and get the answer in seconds.</p><p>Let’s see it in action with two tiny tables that look identical… and then break them on purpose.</p><h4>Why HASH Is Usually Perfect</h4><p>HASH(*) has three killer properties:</p><ol><li>Deterministic — same input → same hash (across sessions, warehouses, even regions)</li><li>Extremely fast — implemented in C++ at the storage layer</li><li>Includes every column automatically (including NULLs and their positions)</li></ol><p>HASH_AGG() builds on this by aggregating those row hashes into one value, making whole-table comparisons trivial without manual XOR logic.</p><p>Because the column order in a table is fixed, HASH(*) produces the same value for identical rows every time. Feeding those into HASH_AGG() gives a collision-resistant fingerprint of the entire dataset.</p><h4>Step 1: Create Sample Tables</h4><pre>create or replace table table1(id int, name varchar);<br>insert into table1 values<br>  (1,&#39;Sam&#39;), (2,&#39;David&#39;), (3,&#39;Usher&#39;), (4,&#39;Mike&#39;);<br><br>create or replace table table2(id int, name varchar);<br>insert into table2 values<br>  (1,&#39;Sam&#39;), (2,&#39;David&#39;), (3,&#39;Usher&#39;), (4,&#39;Mike&#39;);</pre><h4>The Fastest Way to Prove Two Tables Are Identical</h4><pre>-- Table 1 signature<br>select <br>  count(*) as row_count,<br>  hash_agg(hash(*)) as table_signature<br>from table1<br>UNION ALL<br>-- Table 2 signature<br>select <br>  count(*) as row_count,<br>  hash_agg(hash(*)) as table_signature<br>from table2;</pre><p>Same row count + same signature = tables are identical (Takes &lt; 1 second even on billions of rows)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*WEE_I0zi7hFxOHU8furS5A.png" /></figure><h3>Now Let’s Break One Row and Watch It Fail Instantly</h3><pre>update table2 set name = &#39;Michael&#39; where id = 4;</pre><p>Run the same queries again:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*ZNDFmHfyUiuaGxtndeVfWw.png" /></figure><p>Even though only one character changed, the entire table signature flipped immediately. No false positives.</p><h3>Find Exactly Which Rows Differ (Still Blazing Fast)</h3><pre>select <br>  coalesce(t1.id, t2.id) as id,<br>  t1.name as name_table1,<br>  t2.name as name_table2,<br>  t1.row_hash,<br>  t2.row_hash<br>from (<br>  select id, name, hash(*) as row_hash <br>  from table1<br>) t1<br>full outer join (<br>  select id, name, hash(*) as row_hash <br>  from table2<br>) t2 using(id)<br>where t1.row_hash != t2.row_hash<br>   or t1.row_hash is null <br>   or t2.row_hash is null;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*l7xblgS9cpeGBlRIwFNctQ.png" /></figure><p>Here are the comparison for amount of time each technique may take:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*2Hx0Z2zbHPGtZAlCFDro9w.png" /></figure><p>If you don’t need to compare the entire table, then you can just hash each column and just compare them against the other tables column hashes. You can also use the ILIKE and EXCLUDE keywords for filtering.</p><h3>Note:</h3><ul><li>Any two values of type NUMBER that compare equally will hash to the same hash value, even if the respective types have different precision and/or scale.</li><li>Any two values of type FLOAT that can be converted to NUMBER(38, 0) without loss of precision will hash to the same value.</li><li>Any two values of type TIMESTAMP_TZ that compare equally will hash to the same hash value, even if the timestamps are from different time zones.</li><li>Hash value guarantee also applies to NUMBER, FLOAT, and TIMESTAMP_TZ values within a VARIANT column.</li><li>Do not use HASH to create unique keys. HASH has a finite resolution of 64 bits, and is guaranteed to return non-unique values if more than 2⁶⁴ values are entered (e.g. for a table with more than 2⁶⁴ rows). In practice, if the input is on the order of 2³² rows (approximately 4 billion rows) or more, the function is reasonably likely to return at least one duplicate value.</li><li>HASH_AGG computes a “fingerprint” over an entire table, query result, or window. Any change to the input will influence the result of HASH_AGG with overwhelming probability. This can be used to quickly detect changes to table contents or query results.</li><li>Note that it is possible, though very unlikely, that two different input tables will produce the same result for HASH_AGG. If you need to make sure that two tables or query results that produce the same HASH_AGG result really contain the same data, you must still compare the data for equality (for example, by using the MINUS operator). For more details, see <a href="https://docs.snowflake.com/en/sql-reference/operators-query">Set operators</a>.</li><li>HASH_AGG is <em>not</em> order-sensitive (that is, the order of rows in an input table or query result does not influence the result of HASH_AGG). However, changing the order of input columns <em>does</em> change the result.</li><li>HASH_AGG hashes individual input rows using the <a href="https://docs.snowflake.com/en/sql-reference/functions/hash">HASH</a> function. The salient features of this function carry over to HASH_AGG. In particular, HASH_AGG is “stable” in the sense that any two rows that compare as equal and have compatible types are guaranteed to hash to the same value (that is, they influence the result of HASH_AGG in the same way).</li><li>In contrast to most other aggregate functions, HASH_AGG doesn’t ignore NULL inputs (that is, NULL inputs influence the result of HASH_AGG).</li><li>For both the aggregate function and the window function, duplicate rows, including duplicate all-NULL rows, influence the result. The DISTINCT keyword can be used to suppress the effect of duplicate rows.</li></ul><h3>Conclusion</h3><p>Next time you need to validate a 100 TB table load, don’t write a monster join. Just hash and aggregate it. Refer to <a href="https://docs.snowflake.com/en/sql-reference/functions-hash-scalar">official docs</a> for more details.</p><p>Up Next: I will be covering cryptographic functions offered by snowflake in the next blog. Happy coding❄️❄️❄️!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*AiaaIvF_ubYmMwRJvAy1yg.png" /></figure><p><em>***May not be suitable for full unit testing that require full confidence. For absolute, provable, zero-collision certainty, switch to a cryptographic hash or other techniques listed above.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15122186d0b9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/snowflake/hash-%EF%B8%8F%E2%83%A3-functions-in-snowflake-%EF%B8%8F-the-fastest-way-to-compare-massive-tables-15122186d0b9">Hash#️⃣ Functions in Snowflake❄️: The Fastest Way to Compare Massive Tables</a> was originally published in <a href="https://medium.com/snowflake">Snowflake Builders Blog: Data Engineers, App Developers, AI, &amp; Data Science</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[❄️Building a Snowflake ADMIN Agent: Ask your Snowflake account anything in plain English]]></title>
            <link>https://medium.com/snowflake/%EF%B8%8Fbuilding-a-snowflake-admin-agent-ask-your-snowflake-account-anything-in-plain-english-3bcc02a22176?source=rss-9c113069bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/3bcc02a22176</guid>
            <category><![CDATA[text-to-sql]]></category>
            <category><![CDATA[cortex-analyst]]></category>
            <category><![CDATA[database-administration]]></category>
            <category><![CDATA[observability]]></category>
            <category><![CDATA[snowflake-intelligence]]></category>
            <dc:creator><![CDATA[Akshay Rajshekar Shiraguppi]]></dc:creator>
            <pubDate>Wed, 03 Dec 2025 15:03:38 GMT</pubDate>
            <atom:updated>2025-12-03T15:03:38.795Z</atom:updated>
            <content:encoded><![CDATA[<p>Imagine typing:</p><blockquote>“Which warehouse burned the most credits last week?”</blockquote><blockquote>“Show me the top 10 most queried tables yesterday”</blockquote><blockquote>“Which databases haven’t been touched in the last 30 days?”</blockquote><p>…and getting an accurate answer with a chart in seconds — without writing a single line of SQL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*j02Z34klmmGwRAqYNnkziQ.png" /></figure><p>This is now 100% possible inside Snowflake using <strong>Cortex Analyst</strong> + <strong>Snowflake Intelligence</strong>. Below is a complete guide to build your own Snowflake Admin Intelligence Agent using only native Snowflake features and the built-in SNOWFLAKE database metadata.</p><h4>Goal:</h4><blockquote>Create a natural-language interface that answers any Snowflake account administration and cost intelligence question using Cortex Analyst on top of Snowflake’s own ACCOUNT_USAGE and INFORMATION_SCHEMA views.</blockquote><h4><strong>Step 1: Prerequisites</strong></h4><p>Make sure you have all the permissions required to create Cortex Analyst semantic views and then to create agents for Snowflake Intelligence. Refer <a href="https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-analyst#access-control-requirements">1</a> and <a href="https://docs.snowflake.com/en/user-guide/snowflake-cortex/snowflake-intelligence#set-up-sf-intelligence">2</a>.</p><h4><strong>Step 2: Create the Semantic Model (the brain of your agent)</strong></h4><p>Cortex Analyst works by reading a YAML semantic model that describes your tables, columns, relationships, and business meanings.</p><p>Head over to Cortex Analyst under “AI &amp; ML”. Click create new semantic view and select the necessary tables (for demo select any one table) and columns (for demo select any columns). Snowflake’s AI features can also help you in getting started like below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*OMRrHdT_jx8uudkbc5aUmQ.png" /></figure><p>For demo purpose, you may choose to just use the below YAML definition below. Click edit YAML and copy/paste below:</p><pre>name: TEST_SNOWFLAKE_ADMIN<br>tables:<br>  - name: ACCESS_HISTORY<br>    base_table:<br>      database: SNOWFLAKE<br>      schema: ACCOUNT_USAGE<br>      table: ACCESS_HISTORY<br>    dimensions:<br>      - name: BASE_OBJECTS_ACCESSED<br>        expr: BASE_OBJECTS_ACCESSED<br>        data_type: ARRAY<br>      - name: DIRECT_OBJECTS_ACCESSED<br>        expr: DIRECT_OBJECTS_ACCESSED<br>        data_type: ARRAY<br>      - name: OBJECT_MODIFIED_BY_DDL<br>        expr: OBJECT_MODIFIED_BY_DDL<br>        data_type: OBJECT<br>      - name: OBJECTS_MODIFIED<br>        expr: OBJECTS_MODIFIED<br>        data_type: ARRAY<br>      - name: PARENT_QUERY_ID<br>        expr: PARENT_QUERY_ID<br>        data_type: VARCHAR(134217728)<br>      - name: POLICIES_REFERENCED<br>        expr: POLICIES_REFERENCED<br>        data_type: ARRAY<br>      - name: QUERY_ID<br>        expr: QUERY_ID<br>        data_type: VARCHAR(134217728)<br>      - name: ROOT_QUERY_ID<br>        expr: ROOT_QUERY_ID<br>        data_type: VARCHAR(134217728)<br>      - name: USER_NAME<br>        expr: USER_NAME<br>        data_type: VARCHAR(134217728)<br>    time_dimensions:<br>      - name: QUERY_START_TIME<br>        expr: QUERY_START_TIME<br>        data_type: TIMESTAMP_LTZ(9)<br>    primary_key:<br>      columns:<br>        - QUERY_ID<br>  - name: LOGIN_HISTORY<br>    base_table:<br>      database: SNOWFLAKE<br>      schema: ACCOUNT_USAGE<br>      table: LOGIN_HISTORY<br>    dimensions:<br>      - name: _CONNECTION<br>        expr: &#39;&quot;CONNECTION&quot;&#39;<br>        data_type: VARCHAR(134217728)<br>      - name: CLIENT_IP<br>        expr: CLIENT_IP<br>        data_type: VARCHAR(134217728)<br>      - name: ERROR_CODE<br>        expr: ERROR_CODE<br>        data_type: NUMBER(38,0)<br>      - name: ERROR_MESSAGE<br>        expr: ERROR_MESSAGE<br>        data_type: VARCHAR(134217728)<br>      - name: EVENT_ID<br>        expr: EVENT_ID<br>        data_type: NUMBER(38,0)<br>      - name: EVENT_TYPE<br>        expr: EVENT_TYPE<br>        data_type: VARCHAR(134217728)<br>      - name: FIRST_AUTHENTICATION_FACTOR<br>        expr: FIRST_AUTHENTICATION_FACTOR<br>        data_type: VARCHAR(134217728)<br>      - name: IS_SUCCESS<br>        expr: IS_SUCCESS<br>        data_type: VARCHAR(3)<br>      - name: USER_NAME<br>        expr: USER_NAME<br>        data_type: VARCHAR(134217728)<br>    time_dimensions:<br>      - name: EVENT_TIMESTAMP<br>        expr: EVENT_TIMESTAMP<br>        data_type: TIMESTAMP_LTZ(6)<br>  - name: QUERY_HISTORY<br>    base_table:<br>      database: SNOWFLAKE<br>      schema: ACCOUNT_USAGE<br>      table: QUERY_HISTORY<br>    dimensions:<br>      - name: BYTES_READ_FROM_RESULT<br>        expr: BYTES_READ_FROM_RESULT<br>        data_type: NUMBER(38,0)<br>      - name: BYTES_SCANNED<br>        expr: BYTES_SCANNED<br>        data_type: NUMBER(38,0)<br>      - name: BYTES_SENT_OVER_THE_NETWORK<br>        expr: BYTES_SENT_OVER_THE_NETWORK<br>        data_type: NUMBER(38,0)<br>      - name: BYTES_SPILLED_TO_LOCAL_STORAGE<br>        expr: BYTES_SPILLED_TO_LOCAL_STORAGE<br>        data_type: NUMBER(38,0)<br>      - name: BYTES_SPILLED_TO_REMOTE_STORAGE<br>        expr: BYTES_SPILLED_TO_REMOTE_STORAGE<br>        data_type: NUMBER(38,0)<br>      - name: BYTES_WRITTEN<br>        expr: BYTES_WRITTEN<br>        data_type: NUMBER(38,0)<br>      - name: BYTES_WRITTEN_TO_RESULT<br>        expr: BYTES_WRITTEN_TO_RESULT<br>        data_type: NUMBER(38,0)   <br>      - name: CLUSTER_NUMBER<br>        expr: CLUSTER_NUMBER<br>        data_type: NUMBER(38,0)<br>      - name: COMPILATION_TIME<br>        expr: COMPILATION_TIME<br>        data_type: NUMBER(38,0)<br>      - name: DATABASE_NAME<br>        expr: DATABASE_NAME<br>        data_type: VARCHAR(134217728)<br>      - name: ERROR_MESSAGE<br>        expr: ERROR_MESSAGE<br>        data_type: VARCHAR(134217728)<br>      - name: EXECUTION_STATUS<br>        expr: EXECUTION_STATUS<br>        data_type: VARCHAR(134217728)<br>      - name: EXECUTION_TIME<br>        expr: EXECUTION_TIME<br>        data_type: NUMBER(38,0)<br>      - name: PARTITIONS_SCANNED<br>        expr: PARTITIONS_SCANNED<br>        data_type: NUMBER(38,0)<br>      - name: PARTITIONS_TOTAL<br>        expr: PARTITIONS_TOTAL<br>        data_type: NUMBER(38,0)<br>      - name: QUERY_PARAMETERIZED_HASH<br>        expr: QUERY_PARAMETERIZED_HASH<br>        data_type: VARCHAR(134217728)<br>      - name: QUERY_TAG<br>        expr: QUERY_TAG<br>        data_type: VARCHAR(134217728)<br>      - name: QUERY_TEXT<br>        expr: QUERY_TEXT<br>        data_type: VARCHAR(134217728)<br>      - name: QUERY_TYPE<br>        expr: QUERY_TYPE<br>        data_type: VARCHAR(134217728)<br>      - name: ROLE_NAME<br>        expr: ROLE_NAME<br>        data_type: VARCHAR(134217728)<br>      - name: TOTAL_ELAPSED_TIME<br>        expr: TOTAL_ELAPSED_TIME<br>        data_type: NUMBER(38,0)<br>      - name: USER_DATABASE_NAME<br>        expr: USER_DATABASE_NAME<br>        data_type: VARCHAR(134217728)<br>      - name: USER_NAME<br>        expr: USER_NAME<br>        data_type: VARCHAR(134217728)<br>      - name: WAREHOUSE_NAME<br>        expr: WAREHOUSE_NAME<br>        data_type: VARCHAR(134217728)<br>      - name: WAREHOUSE_SIZE<br>        expr: WAREHOUSE_SIZE<br>        data_type: VARCHAR(134217728)<br>    time_dimensions:<br>      - name: END_TIME<br>        expr: END_TIME<br>        data_type: TIMESTAMP_LTZ(6)<br>      - name: START_TIME<br>        expr: START_TIME<br>        data_type: TIMESTAMP_LTZ(6)<br>    facts:<br>      - name: CREDITS_USED_CLOUD_SERVICES<br>        expr: CREDITS_USED_CLOUD_SERVICES<br>        data_type: FLOAT<br>        access_modifier: public_access<br>      - name: PERCENTAGE_SCANNED_FROM_CACHE<br>        expr: PERCENTAGE_SCANNED_FROM_CACHE<br>        data_type: FLOAT<br>        access_modifier: public_access<br>  - name: WAREHOUSE_METERING_HISTORY<br>    base_table:<br>      database: SNOWFLAKE<br>      schema: ACCOUNT_USAGE<br>      table: WAREHOUSE_METERING_HISTORY<br>    dimensions:<br>      - name: WAREHOUSE_ID<br>        expr: WAREHOUSE_ID<br>        data_type: NUMBER(38,0)<br>      - name: WAREHOUSE_NAME<br>        expr: WAREHOUSE_NAME<br>        data_type: VARCHAR(16777216)<br>    time_dimensions:<br>      - name: END_TIME<br>        expr: END_TIME<br>        data_type: TIMESTAMP_LTZ(0)<br>      - name: START_TIME<br>        expr: START_TIME<br>        data_type: TIMESTAMP_LTZ(0)<br>    facts:<br>      - name: CREDITS_ATTRIBUTED_COMPUTE_QUERIES<br>        expr: CREDITS_ATTRIBUTED_COMPUTE_QUERIES<br>        data_type: NUMBER(38,9)<br>        access_modifier: public_access<br>      - name: CREDITS_USED<br>        expr: CREDITS_USED<br>        data_type: NUMBER(38,9)<br>        access_modifier: public_access<br>      - name: CREDITS_USED_CLOUD_SERVICES<br>        expr: CREDITS_USED_CLOUD_SERVICES<br>        data_type: NUMBER(38,9)<br>        access_modifier: public_access<br>      - name: CREDITS_USED_COMPUTE<br>        expr: CREDITS_USED_COMPUTE<br>        data_type: NUMBER(38,9)<br>        access_modifier: public_access<br>    primary_key:<br>      columns:<br>        - WAREHOUSE_ID<br>relationships:<br>  - name: &#39;&quot;Query to access history&quot;&#39;<br>    left_table: QUERY_HISTORY<br>    right_table: ACCESS_HISTORY<br>    relationship_columns:<br>      - left_column: QUERY_ID<br>        right_column: QUERY_ID<br>  - name: &#39;&quot;Query to warehouse history&quot;&#39;<br>    left_table: QUERY_HISTORY<br>    right_table: WAREHOUSE_METERING_HISTORY<br>    relationship_columns:<br>      - left_column: WAREHOUSE_ID<br>        right_column: WAREHOUSE_ID</pre><p>Next, you may add verified queries for commonly asked/wrongly interpreted questions. Add custom instructions to assist the semantic view in any other way.<br>For example: You could add “Avoid filtering on query_text field in query_history view directly and instead use fuzzy search” instruction to avoid inaccurate results.</p><p><em>Note: If you see any warnings in the relationships section then add a unique/primary key for each table.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*MkBOf1Qdyo19xC_Xpz6ZpQ.png" /></figure><h4><strong>Step 3: Create a Snowflake Intelligence Agent</strong></h4><p>Go to Agents under “AI &amp; ML” section and hit create agent. Fill in the values and hit create. Then click edit and add the previously created analyst here. You can play around with other options here too.</p><p>Hurray! Assuming permissions have been set up properly, this is ready to be used.</p><h3>Example Questions</h3><blockquote>“Which warehouse consumed the most credits in the last 7 days?”</blockquote><blockquote>“Show me daily credit burn by warehouse for the last 30 days”</blockquote><blockquote>“Which databases were accessed the most yesterday by query count?”</blockquote><blockquote>“List databases that haven’t been queried in the last 60 days”</blockquote><blockquote>“Who ran the most expensive queries last week?”</blockquote><blockquote>“Show login attempts by users in the last 24 hours”</blockquote><blockquote>“Which users are still using the deprecated warehouse ‘OLD_WH’?”</blockquote><h3>Security &amp; Governance</h3><ul><li>Row-level and column-level security in ACCOUNT_USAGE is respected</li><li>Use roles to limit what the agent can see.</li></ul><h3>Conclusion</h3><p>You now have a full-featured Snowflake Intelligence agent that</p><ul><li>Understands natural language</li><li>Generates correct, optimized SQL against ACCOUNT_USAGE</li><li>Shows charts automatically</li><li>Costs pennies per day to run</li></ul><p>This is just a simple use case. By bringing in other Snowflake tables/views and specifying relationship you can answer a lot more about your Snowflake account with just a few words. Perhaps, this can act as quick account monitoring tool to you or your non technical supervisors. Let me know if this has helped you in some way or how you plan to build on it.</p><p>Something to try out:</p><blockquote>Try bringing in more tables/views to answer questions like “What are the top 10 largest tables by storage right now?”.<br>Flatten the Array/JSON fields in access_history view.<br>Create cortex search on text fields like query_text.</blockquote><p>Read more <a href="https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-analyst#overview">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bcc02a22176" width="1" height="1" alt=""><hr><p><a href="https://medium.com/snowflake/%EF%B8%8Fbuilding-a-snowflake-admin-agent-ask-your-snowflake-account-anything-in-plain-english-3bcc02a22176">❄️Building a Snowflake ADMIN🔍 Agent: Ask your Snowflake account anything in plain English</a> was originally published in <a href="https://medium.com/snowflake">Snowflake Builders Blog: Data Engineers, App Developers, AI, &amp; Data Science</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[❄️Harnessing Snowflake’s Cortex AI: Exploring Cortex Analyst and Cortex Search]]></title>
            <link>https://medium.com/snowflake/%EF%B8%8Fharnessing-snowflakes-cortex-ai-exploring-cortex-analyst-and-cortex-search-319220a81e20?source=rss-9c113069bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/319220a81e20</guid>
            <category><![CDATA[data-insights]]></category>
            <category><![CDATA[cortex-ai]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[snowflake-intelligence]]></category>
            <category><![CDATA[cortex-search]]></category>
            <dc:creator><![CDATA[Akshay Rajshekar Shiraguppi]]></dc:creator>
            <pubDate>Thu, 23 Oct 2025 14:01:51 GMT</pubDate>
            <atom:updated>2025-10-23T14:01:51.818Z</atom:updated>
            <content:encoded><![CDATA[<p>The explosion of data in modern organizations has made extracting insights both a superpower and a challenge. Snowflake’s Cortex AI suite — specifically Cortex Analyst for conversational analytics on structured data and Cortex Search for semantic searches on unstructured text — bridges this gap by embedding generative AI directly into your data platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nyCCenpOZwq5JJOrwA7Hrw.png" /></figure><blockquote>With these tools, you can ask questions like “What’s driving sales in Q2?” or “Find customer complaints about delivery delays” and get precise, actionable results without relying on Engineering teams or complex SQL.</blockquote><blockquote><strong>Note:</strong></blockquote><blockquote><strong>The results are still AI driven so it may not be a good idea to only rely on it and make important decisions.</strong></blockquote><blockquote><strong>Snowflake now offers the ability to do all the development in Snowsight UI.</strong></blockquote><p>In this post, we’ll build a hands-on demo using two fresh open-source datasets:</p><ul><li><strong>Structured Data</strong>: Retail sales data from the UCI Machine Learning Repository’s “Online Retail Dataset” (CC0-licensed, ~500K transactions).</li><li><strong>Unstructured Data</strong>: Yelp review dataset from Kaggle (also CC0, ~150K text reviews).</li></ul><p>We’ll walk through loading these datasets into Snowflake, configuring Cortex Analyst for natural language queries, and setting up Cortex Search for semantic text retrieval. Let’s dive in.</p><h4>Why Cortex? AI That Lives in Your Data</h4><p><a href="https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-analyst">Cortex Analyst</a> translates plain-English questions into SQL, leveraging semantic models to understand your schema.</p><p><a href="https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-search/cortex-search-overview">Cortex Search</a>, meanwhile, combines vector-based semantic search with keyword precision, perfect for digging through text like reviews or support tickets.</p><p>Both run securely within Snowflake’s ecosystem, ensuring governance and scalability.</p><p>Our goal: Use Cortex Analyst to analyze retail sales trends (e.g., “Which products sold best in the UK?”) and Cortex Search to surface insights from Yelp reviews (e.g., “Find reviews mentioning poor service”). Here’s how.</p><h3>Step 1: Setting Up the Environment</h3><p>You’ll need a Snowflake account with ACCOUNTADMIN privileges. We’ll create a demo database and load our datasets.</p><h4>Loading the UCI Retail Dataset for Cortex Analyst</h4><p>The UCI Online Retail Dataset contains ~500K rows of e-commerce transactions (invoices, products, quantities, etc.). Download it from UCI’s archive and upload the CSV to a Snowflake stage.</p><pre>-- Create demo environment<br>USE ROLE ACCOUNTADMIN;<br>CREATE OR REPLACE DATABASE cortex_open_demo;<br>CREATE OR REPLACE SCHEMA retail;<br>CREATE OR REPLACE WAREHOUSE cortex_wh WITH WAREHOUSE_SIZE = &#39;XSMALL&#39;;<br><br>USE DATABASE cortex_open_demo;<br>USE SCHEMA retail;<br>USE WAREHOUSE cortex_wh;<br><br>-- Create table for retail data<br>CREATE OR REPLACE TABLE retail_sales (<br>    invoice_no VARCHAR,<br>    stock_code VARCHAR,<br>    description VARCHAR,<br>    quantity INT,<br>    invoice_date TIMESTAMP,<br>    unit_price FLOAT,<br>    customer_id VARCHAR,<br>    country VARCHAR<br>);<br><br>-- Stage and load data (assumes CSV uploaded to @retail_stage)<br>CREATE OR REPLACE STAGE retail_stage;<br>-- Use Snowsight or PUT to upload online_retail.csv<br>COPY INTO retail_sales<br>FROM @retail_stage/online_retail.csv<br>FILE_FORMAT = (TYPE = CSV SKIP_HEADER = 1 FIELD_OPTIONALLY_ENCLOSED_BY = &#39;&quot;&#39;);<br><br>-- Sample data preview<br>SELECT * FROM retail_sales LIMIT 5;<br>-- Example rows:<br>-- | 536365 | 85123A | CREAM CUPID HEARTS COAT HANGER | 8 | 2010-12-01 08:26:00 | 2.75 | 17850 | United Kingdom |<br>-- | 536365 | 71053 | WHITE METAL LANTERN | 6 | 2010-12-01 08:26:00 | 3.39 | 17850 | United Kingdom |</pre><p>This dataset includes transactions from 2010–2011, covering products, quantities, and countries — ideal for sales analytics.</p><h4>Loading the Yelp Reviews Dataset for Cortex Search</h4><p>The Yelp dataset (available on <a href="https://www.kaggle.com/search?q=yelp+reviews+in%3Adatasets">Kaggle</a>: “Yelp Open Dataset”) contains business reviews. We’ll use a subset of ~1000 reviews for simplicity. Download the yelp_academic_dataset_review.json and convert a sample to CSV (or use a script to parse JSON into Snowflake).</p><pre>-- Switch schema<br>CREATE OR REPLACE SCHEMA reviews;<br>USE SCHEMA reviews;<br><br>-- Create table for reviews<br>CREATE OR REPLACE TABLE yelp_reviews (<br>    review_id VARCHAR,<br>    business_id VARCHAR,<br>    review_text VARCHAR,<br>    stars INT,<br>    review_date DATE<br>);<br><br>-- Stage and load (assumes CSV subset created from JSON)<br>CREATE OR REPLACE STAGE review_stage;<br>COPY INTO yelp_reviews<br>FROM @review_stage/yelp_reviews_subset.csv<br>FILE_FORMAT = (TYPE = CSV SKIP_HEADER = 1 FIELD_OPTIONALLY_ENCLOSED_BY = &#39;&quot;&#39;);<br><br>-- Sample data<br>INSERT INTO yelp_reviews (review_id, business_id, review_text, stars, review_date) VALUES<br>(&#39;r1&#39;, &#39;b1&#39;, &#39;Food was amazing, but the service was slow and unattentive.&#39;, 3, &#39;2023-05-10&#39;),<br>(&#39;r2&#39;, &#39;b2&#39;, &#39;Best pizza in town! Staff is super friendly.&#39;, 5, &#39;2023-05-11&#39;),<br>(&#39;r3&#39;, &#39;b1&#39;, &#39;Overpriced for mediocre food. Waited 20 mins for a table.&#39;, 2, &#39;2023-05-12&#39;),<br>(&#39;r4&#39;, &#39;b3&#39;, &#39;Cozy vibe, but delivery took forever.&#39;, 3, &#39;2023-05-13&#39;);</pre><p>This gives us a rich text corpus for semantic search.</p><h3>Step 2: Cortex Analyst — Conversational Analytics on Retail Sales</h3><p>To enable natural language queries, we define a <a href="https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-analyst/semantic-model-spec#semantic-layer-concepts">semantic model</a> mapping business terms to our schema.</p><p><em>Note: This can also be developed/tested via snowsight UI which provides much simpler interface to do so.</em></p><p>Creating the Semantic Model:</p><pre>CREATE OR REPLACE STAGE semantic_stage;</pre><p>Copy and save below as retail_semantic.yaml and upload it to the stage:</p><pre>model:<br>  name: retail_analysis<br>  description: E-commerce sales analysis for UCI retail dataset<br><br>tables:<br>  - name: retail_sales<br>    base_table:<br>      database: cortex_open_demo<br>      schema: retail<br>      table: retail_sales<br>    facts:<br>      - name: total_revenue<br>        expr: SUM(quantity * unit_price)<br>        description: Total sales revenue<br>      - name: total_quantity<br>        expr: SUM(quantity)<br>        description: Total units sold<br>    dimensions:<br>      - name: country<br>        expr: country<br>        description: Country of sale<br>        data_type: VARCHAR<br>        sample_values: [&#39;United Kingdom&#39;, &#39;Germany&#39;, &#39;France&#39;]<br>      - name: invoice_date<br>        expr: invoice_date<br>        description: Date of sale<br>        data_type: TIMESTAMP<br>      - name: product<br>        expr: description<br>        description: Product description<br>        data_type: VARCHAR<br>        sample_values: [&#39;CREAM CUPID HEARTS COAT HANGER&#39;, &#39;WHITE METAL LANTERN&#39;]</pre><p>This model enables queries like “Total revenue in Germany for 2011.”</p><h4>Querying with Cortex Analyst:</h4><p>Use a Streamlit app in Snowflake (SiS) or <a href="https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-agents">Cortex Agent</a> or <a href="https://docs.snowflake.com/en/user-guide/snowflake-cortex/snowflake-intelligence">Snowflake Intelligence</a> or any other third party services to interact with the Analyst.</p><p>SiS Example:</p><pre>import streamlit as st<br>from snowflake.snowpark.context import get_active_session<br>from snowflake.ml.cortex import Analyst<br><br>session = get_active_session()<br>analyst = Analyst(model=&quot;retail_analysis&quot;, database=&quot;cortex_open_demo&quot;, schema=&quot;retail&quot;, stage=&quot;semantic_stage&quot;)<br><br>st.title(&quot;Retail Insights Bot&quot;)<br>query = st.text_input(&quot;Ask about sales:&quot;)<br><br>if query:<br>    response = analyst.query(query)<br>    st.write(&quot;SQL:&quot;, response.sql)<br>    st.write(&quot;Answer:&quot;, response.result)<br>    st.dataframe(response.result_df)</pre><p><strong>Example Query</strong>: “What’s the total revenue for United Kingdom in December 2010?”</p><ul><li><strong>SQL Generated</strong>: SELECT SUM(quantity * unit_price) AS total_revenue FROM retail_sales WHERE country = ‘United Kingdom’ AND invoice_date &gt;= ‘2010–12–01’ AND invoice_date &lt; ‘2011–01–01’;</li><li><strong>Result</strong>: ~750,000 (exact value depends on dataset; displays as a DataFrame).</li></ul><h3>Step 3: Cortex Search — Semantic Insights from Yelp Reviews</h3><p>Cortex Search indexes our review text for fast, context-aware retrieval.</p><p>Creating the Search Service:</p><p><em>Note: This can also be developed/tested via Snowsight UI which provides much simpler interface to do so.</em></p><pre>CREATE OR REPLACE CORTEX SEARCH SERVICE yelp_search<br>  ON (SELECT review_id, review_text, stars, review_date FROM yelp_reviews)<br>  WAREHOUSE = cortex_wh;</pre><p>This indexes the review_text column (1–2 minutes for our subset).</p><h4>Searching with Cortex Search:</h4><p><em>Note: This part can also be done via Snowsight UI, Cortex Agents, Snowflake Intelligence.</em></p><p>Run a semantic query:</p><pre>SELECT * FROM TABLE(SNOWFLAKE.CORTEX.SEARCH(&#39;yelp_search&#39;, &#39;complaints about slow service&#39;));</pre><p>Integrate into Streamlit:</p><pre>import snowflake.snowpark as snowpark<br><br>query = st.text_input(&quot;Search Yelp reviews:&quot;)<br>if query:<br>    df = session.sql(f&quot;SELECT * FROM TABLE(SNOWFLAKE.CORTEX.SEARCH(&#39;yelp_search&#39;, &#39;{query}&#39;))&quot;).collect()<br>    for row in df:<br>        st.write(f&quot;Review {row[&#39;review_id&#39;]}: {row[&#39;review_text&#39;][:100]}... (Stars: {row[&#39;stars&#39;]})&quot;)</pre><h3>Step 4: Building a Unified App or Leverage Snowflake Intelligence</h3><p>Combine Analyst and Search in a Streamlit dashboard or use Snowflake Intelligence (via Cortex Agents).</p><p>Example:</p><ul><li><strong>Tab 1</strong>: Analyst for sales metrics (“Revenue by country”).</li><li><strong>Tab 2</strong>: Search for review insights (“Negative feedback trends”).</li><li><strong>Bonus</strong>: Use SNOWFLAKE.CORTEX.COMPLETE to summarize search results (e.g., “15% of reviews mention slow service”).</li></ul><p>Query Analyst for low-performing products, then use Search to find related customer complaints. Deploy via Cortex Agents (Snowflake Intelligence) or Snowflake’s REST APIs for a production app.</p><h3>Key Takeaways and Next Steps</h3><p>With the UCI Retail and Yelp datasets, we’ve seen Cortex Analyst and Search transform raw data into conversational insights. These open-source datasets are just a start — swap in your CRM data or support tickets to unlock real-world value.</p><p><strong>Experiment</strong>: Tweak the semantic model or search queries in Snowsight.<br>Add verified queries, model instructions, etc.</p><p>What insights will you uncover? Share your experiments below or ping me for a deeper dive into Snowflake’s AI capabilities.</p><p><em>More:</em><br><em>Dive into other AI/ML features of snowflake: </em><a href="https://docs.snowflake.com/en/guides-overview-ai-features"><em>https://docs.snowflake.com/en/guides-overview-ai-features</em></a></p><p><em>Look into how using both in synergy gives more efficient results:<br> </em><a href="https://www.snowflake.com/en/engineering-blog/cortex-analyst-cortex-search-integration"><em>https://www.snowflake.com/en/engineering-blog/cortex-analyst-cortex-search-integration</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=319220a81e20" width="1" height="1" alt=""><hr><p><a href="https://medium.com/snowflake/%EF%B8%8Fharnessing-snowflakes-cortex-ai-exploring-cortex-analyst-and-cortex-search-319220a81e20">❄️Harnessing Snowflake’s Cortex AI: Exploring Cortex Analyst and Cortex Search</a> was originally published in <a href="https://medium.com/snowflake">Snowflake Builders Blog: Data Engineers, App Developers, AI, &amp; Data Science</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Snowflake’s❄️ New Spread Operator: Expanding Arrays Made Easy]]></title>
            <link>https://medium.com/@akshayrs1993/exploring-snowflakes-new-spread-operator-a-game-changer-for-data-manipulation-e4abd36453cc?source=rss-9c113069bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4abd36453cc</guid>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[expansion-operators]]></category>
            <dc:creator><![CDATA[Akshay Rajshekar Shiraguppi]]></dc:creator>
            <pubDate>Thu, 29 May 2025 22:53:19 GMT</pubDate>
            <atom:updated>2025-12-08T22:01:23.964Z</atom:updated>
            <content:encoded><![CDATA[<p>Snowflake, the cloud data platform, continues to evolve with features that make data manipulation more intuitive and powerful. In its September 2025 release (version 9.07), Snowflake introduced the <strong>spread operator</strong>, a new tool that simplifies working with complex data structures like arrays and objects. If you’re a data engineer, analyst, or developer using Snowflake, this feature is worth exploring. Let’s dive into what the spread operator is, how it works, and why it matters.</p><h3>What Is the Spread Operator?</h3><p>The spread operator (**) in Snowflake expands an array into a comma-separated list of individual values. This is particularly useful in scenarios where you need to pass multiple values to clauses or functions, such as IN predicates or variadic functions like COALESCE, GREATEST, or LEAST. It’s inspired by similar operators in programming languages and simplifies writing dynamic queries with array inputs.</p><p>According to the Snowflake documentation on expansion operators, it’s the only expansion operator currently supported and works with arrays of constant values or bind variables</p><h3>How Does It Work?</h3><p>The syntax is simple: prefix the array with **. This unpacks the array elements inline.</p><p>The array must contain literal values or a bind variable representing literals, and elements can be of types like numeric, string, boolean, date, or time (all wrapped in VARIANT).</p><h3>Examples:</h3><p>Here are some corrected and accurate examples based on the docs:</p><h4>1. Using in an IN Clause</h4><p>Suppose you have a table spread_demo. Belowexpands [3, 4] to 3, 4 in the IN clause.</p><pre>CREATE TABLE spread_demo (col1 INT, col2 VARCHAR);<br>INSERT INTO spread_demo VALUES (1, &#39;a&#39;), (2, &#39;b&#39;), (3, &#39;c&#39;), (4, &#39;d&#39;), (5, &#39;e&#39;);<br><br>SELECT * FROM spread_demo WHERE col1 IN (**[3, 4]) ORDER BY col1;<br>--This expands [3, 4] to 3, 4 in the IN clause.</pre><h4>2. Mixed Values in IN</h4><pre>SELECT * FROM spread_demo WHERE col1 IN (**[1, 2], 4, 5) ORDER BY col1;</pre><p>Here, it combines the expanded array with additional literals.</p><h4>3. In System-Defined Functions like COALESCE</h4><pre>SELECT COALESCE(**[NULL, NULL, &#39;my_string_1&#39;, &#39;my_string_2&#39;]) AS first_non_null;</pre><p>GREATEST_VALUE= 5 is the result</p><h4>5. In SQL User-Defined Functions (UDFs)</h4><pre>CREATE OR REPLACE FUNCTION spread_function_demo(col_1_values ARRAY)<br>RETURNS TABLE (col1 INT, col2 VARCHAR)<br>AS $$<br>SELECT * FROM spread_demo WHERE col1 IN (**col_1_values) ORDER BY col1<br>$$;</pre><pre>SELECT * FROM TABLE(spread_function_demo([1, 3, 5]));</pre><h4>6. In Snowflake Scripting Stored Procedures</h4><pre>CREATE OR REPLACE PROCEDURE spread_sp_demo(col_1_values ARRAY)<br>RETURNS TABLE (col1 INT, col2 VARCHAR)<br>LANGUAGE SQL<br>AS $$<br>DECLARE res RESULTSET;<br>BEGIN<br>  res := (SELECT * FROM spread_demo WHERE col1 IN (**:col_1_values) ORDER BY col1);<br>  RETURN TABLE(res);<br>END;<br>$$;<br><br>CALL spread_sp_demo([2, 4]);</pre><h3>Why Is This Useful?</h3><ul><li><strong>Simplifies Dynamic Queries</strong>: Easily pass arrays to IN clauses without concatenating strings or using multiple OR conditions.</li><li><strong>Enhances UDFs and Procedures</strong>: Makes it straightforward to handle array inputs in custom functions and procs.</li><li><strong>Improves Readability</strong>: Replaces verbose alternatives with concise syntax.</li><li><strong>Performance Considerations</strong>: Be cautious with very large arrays, as expansion can impact query performance.</li></ul><h3>Limitations</h3><ul><li>Input must be arrays of constants or bind variables.</li><li>Supports specific data types (numeric, string, boolean, date/time).</li><li>Not usable in non-SQL UDFs or procedures.</li><li>Potential performance hit with large arrays.</li></ul><h3>Final Thoughts</h3><p>The spread operator (**) is a handy addition for working with arrays in list-based operations. It’s not for row explosion like FLATTEN, but for inline value expansion.</p><p>For full details, refer to the Snowflake release notes and expansion operators <a href="https://docs.snowflake.com/en/sql-reference/operators-expansion?_ga=2.206446612.608678356.1765227834-783277824.1710347469">documentation</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4abd36453cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Snowflake Cortex Multimodal COMPLETE: Powering AI in the Data Cloud for Image Analysis️❄️]]></title>
            <link>https://medium.com/@akshayrs1993/snowflake-cortex-multimodal-complete-powering-ai-in-the-data-cloud-%EF%B8%8F-%EF%B8%8F-4593c3787e98?source=rss-9c113069bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/4593c3787e98</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[snowflake-cortex]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[image-analysis]]></category>
            <category><![CDATA[multimodal]]></category>
            <dc:creator><![CDATA[Akshay Rajshekar Shiraguppi]]></dc:creator>
            <pubDate>Wed, 16 Apr 2025 23:55:58 GMT</pubDate>
            <atom:updated>2025-04-17T19:44:30.493Z</atom:updated>
            <content:encoded><![CDATA[<p>Snowflake Cortex, as we already know, integrates advanced AI into the Snowflake Data Cloud, enabling users to leverage large language models (LLMs) for text and <strong>image processing</strong> without leaving their data environment. The COMPLETE function, a cornerstone of Cortex, now supports multimodal inputs, allowing SQL-based interaction with models to analyze text, images, or both. This capability is transformative for businesses aiming to extract insights from diverse data types — think product images, handwritten notes, or marketing visuals — while keeping workflows streamlined within Snowflake. <br>In this blog, let’s unpack the COMPLETE function’s multimodal features and showcase its potential with practical, unique examples.</p><h3>Understanding COMPLETE</h3><p>The COMPLETE function lets users query multimodal LLMs directly in Snowflake. Its syntax is:</p><pre>SNOWFLAKE.CORTEX.COMPLETE(<br>    &#39;&lt;model&gt;&#39;, &#39;&lt;prompt&gt;&#39;, &lt;file_object&gt;)<br>FROM &lt;table&gt;;</pre><ul><li><strong>model</strong>: The LLM, e.g., pixtral-large and pixtral-large are the only supported ones currently.</li><li><strong>prompt</strong>: A text string or JSON with text and image URLs (stored in Snowflake stages).</li><li><strong>file_object</strong>: The image to analyze. This has to be server side encrypted and directory table enabled on it’s stage.</li></ul><p>Multimodal support means you can combine text instructions with images to generate insights, summaries, or creative outputs, all within a SQL query.</p><h3>Why It’s a Game-Changer?</h3><p>Most AI tools require external platforms for image processing, fragmenting workflows. COMPLETE keeps everything in Snowflake, enabling:</p><ol><li><strong>Unified Data Processing</strong>: Analyze structured data (tables) and unstructured data (images) together.</li><li><strong>Business Applications</strong>: From e-commerce (product descriptions) to operations (document parsing), it’s versatile.</li><li><strong>Accessibility</strong>: SQL-based, so analysts without coding expertise can use it.</li></ol><h3>Practical Examples:</h3><h4>Example 1: Extracting Objects from a Living Room</h4><p>You have a image and need to identify objects for tagging.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TXl-2zGeH4s3MNPR76Xx2w.jpeg" /></figure><pre>SELECT SNOWFLAKE.CORTEX.COMPLETE(&#39;pixtral-large&#39;,<br>&#39;Extract all objects identified in this image. Respond in JSON only with the identified objects.&#39;,<br>TO_FILE(&#39;@image_analysis_test&#39;, &#39;Lyra-at-Skyline-Plan-1-Model-Home-Great-Room.jpg&#39;));</pre><p>Response:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/238/1*Ba_PZSXl6gmu-9RH5_jR4Q.png" /></figure><h4>Example 2: Extracting Chart information</h4><p>You have a GDP chart image and need to extract ranking information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-WvrgLNmOkIH43O5t3fsMg.png" /></figure><pre>SELECT SNOWFLAKE.CORTEX.COMPLETE(&#39;pixtral-large&#39;,<br>    &#39;Find 2nd and 6th ranked countris. Respond in JSON only with the identified country name.&#39;,<br>    TO_FILE(&#39;@image_analysis_test&#39;, &#39;gdp.png&#39;));</pre><p>Response:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/221/1*DFmppOmFdgTeuUbPv3hySw.png" /></figure><h3>Best Practices:</h3><ul><li><strong>Image Prep</strong>: Use Snowflake stages for secure image storage; stick to PNG/JPEG formats.</li><li><strong>Prompt Clarity</strong>: Be specific in text instructions to get precise outputs.</li><li><strong>Optimize Costs</strong>: Multimodal models are resource-heavy; test with small inputs first.</li></ul><h3>Limitations:</h3><ul><li><strong>Regional Availability</strong>: Some models aren’t available everywhere (check Snowflake’s docs).</li><li><strong>Image Size</strong>: Large files slow processing; resize to ~1MB or less.</li><li><strong>Prompt Tuning</strong>: Vague prompts may yield off-target results; iterate for accuracy.</li><li>Models: Limited to claude-3-5-sonnet and pixtral-largefor now.</li></ul><h3>Conclusion</h3><p>Snowflake Cortex’s COMPLETE function brings multimodal AI to your fingertips, blending text and image analysis in SQL. Whether crafting ad copy or parsing floor plans, it empowers data-driven innovation without external tools. Dive into the <a href="https://docs.snowflake.com/en/sql-reference/functions/complete-snowflake-cortex-multimodal">Snowflake documentation</a> and start experimenting today!<br>More details: <a href="https://www.snowflake.com/en/blog/multimodal-data-analysis-cortex-ai/">https://www.snowflake.com/en/blog/multimodal-data-analysis-cortex-ai/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4593c3787e98" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sending Email Alerts from ❄️Snowflake Stored Procedures/Tasks on Errors]]></title>
            <link>https://medium.com/@akshayrs1993/sending-email-alerts-from-%EF%B8%8Fsnowflake-stored-procedures-tasks-on-errors-53a2db63de43?source=rss-9c113069bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/53a2db63de43</guid>
            <category><![CDATA[stored-procedure]]></category>
            <category><![CDATA[tasks]]></category>
            <category><![CDATA[email-notifications]]></category>
            <category><![CDATA[error-handling]]></category>
            <category><![CDATA[snowflake]]></category>
            <dc:creator><![CDATA[Akshay Rajshekar Shiraguppi]]></dc:creator>
            <pubDate>Mon, 17 Mar 2025 22:02:18 GMT</pubDate>
            <atom:updated>2025-11-26T02:22:45.267Z</atom:updated>
            <content:encoded><![CDATA[<p>Snowflake provides powerful tools for managing data workflows, including the ability to send email notifications and handle exceptions in stored procedures. In this blog, we’ll walk through how to use Snowflake’s email notification feature (as outlined in the <a href="https://docs.snowflake.com/en/user-guide/notifications/email-notifications">Email Notifications Guide</a>) in combination with exception handling in Snowflake Scripting (detailed in the <a href="https://docs.snowflake.com/en/sql-reference/snowflake-scripting/exception">Exception Handling Documentation</a>) to alert users when something goes wrong in a stored procedure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*j3EOtZiaekZ_HaH_BRUiaQ.png" /></figure><h4>Why Use Email Notifications for Errors?</h4><p>Automated email alerts are a great way to stay informed about issues in your Snowflake workflows without manually checking logs or dashboards. Whether it’s a failed data load, a query error, or an unexpected result, you can configure a stored procedure to notify you immediately when an exception is caught.</p><h4>Prerequisites:</h4><ol><li><strong>Email Integration</strong>: Ensure an email integration is set up in Snowflake. This requires an admin to create a notification integration. See the <a href="https://docs.snowflake.com/en/user-guide/notifications/email-notifications#setting-up-email-notifications">Snowflake Email Notifications Guide</a> for setup details.</li><li><strong>Permissions</strong>: You’ll need the appropriate privileges to create and execute stored procedures and use the email integration.</li><li><strong>Snowflake Scripting</strong>: Familiarity with Snowflake’s procedural logic using SQL scripting.</li></ol><h4>Step-by-Step Example:</h4><p>Let’s create a stored procedure that attempts a simple operation, catches an error if it fails, and sends an email notification with details about the issue.</p><p>1. Set Up the Email Notification Integration</p><p>First, an admin must create a notification integration. Here’s a simple example:</p><pre>CREATE NOTIFICATION INTEGRATION my_email_int<br>  TYPE=EMAIL<br>  ENABLED=TRUE;</pre><p>Check the <a href="https://docs.snowflake.com/en/user-guide/notifications/email-notifications#setting-up-email-notifications">Snowflake documentation</a> for full configuration options.</p><p>2. Create the Stored Procedure</p><p>Now, let’s write a stored procedure that simulates an error (e.g., dividing by zero) and sends an email when the exception is caught. We’ll use Snowflake Scripting’s TRY/CATCH block for exception handling and the SYSTEM$SEND_EMAIL function for notifications.</p><pre>CREATE OR REPLACE PROCEDURE send_email_on_error() <br>RETURNS STRING <br>LANGUAGE SQL <br>EXECUTE AS CALLER AS <br>$$ <br>DECLARE <br>error_message STRING; <br>BEGIN   <br> <br>select 10 / 0;   -- Simulate an error (division by zero)<br><br>EXCEPTION     <br>  WHEN OTHER THEN       -- Capture the error message       <br>    error_message := SQLERRM;   <br>               <br>    -- Send email notification       <br>    CALL SYSTEM$SEND_EMAIL(         <br>    &#39;my_email_integration&#39;,-- Name of the email integration         <br>    &#39;your.email@example.com&#39;, -- Recipient email         <br>    &#39;🚨🚨 Snowflake Error Alert: Task/Procedure has failed 🚨🚨&#39;, -- Subject         <br>    &#39;An error occurred: &#39; || error_message -- Body <br>    );              <br>    <br>    -- Return a message to the caller       <br>    RETURN &#39;Error caught and email sent: &#39; || error_message;   <br><br>-- If no error, return success   <br>RETURN &#39;Procedure completed successfully&#39;;<br><br>END; <br>$$;</pre><p>3. Test the Procedure</p><p>Execute the procedure to see it in action:</p><pre>CALL send_email_on_error();</pre><p>Since the procedure attempts to divide by zero, it will throw an exception. The EXCEPTION WHEN OTHER block catches it, retrieves the error message using SQLERRM, and triggers an email via SYSTEM$SEND_EMAIL. You’ll receive an email with a subject like “Error in Snowflake Procedure” and a body containing the error details (e.g., “An error occurred: Division by zero”).</p><p>4. Verify the Output</p><p>The procedure also returns a message to the caller, such as:</p><blockquote>&quot;Error caught and email sent: Division by zero&quot;</blockquote><p>If no error occurs, it simply returns:</p><blockquote>&quot;Procedure completed successfully&quot;</blockquote><h4>Customizing for Your Use Case</h4><ul><li><strong>Dynamic Recipients</strong>: Replace the hardcoded email with a variable or query result to dynamically fetch recipients.</li><li><strong>Detailed Error Info</strong>: Enhance the email body with additional context, like the procedure name, timestamp, or affected table.</li><li><strong>Real-World Logic</strong>: Swap the division-by-zero example with your actual business logic, such as a failing INSERT, UPDATE, or external stage operation.</li></ul><h4>Key Notes</h4><ul><li><strong>Security</strong>: Only users with access to the notification integration can send emails. Ensure the integration is properly secured.</li><li><strong>Rate Limits</strong>: Be mindful of email quotas depending on your email service provider.</li><li><strong>Debugging</strong>: Test your procedure in a development environment before deploying it to production.</li></ul><h4>Conclusion</h4><p>By combining Snowflake’s email notification capabilities with exception handling in stored procedures, you can build robust workflows that proactively alert you to issues. This approach saves time, reduces manual monitoring, and ensures you’re always in the loop when something goes wrong.</p><p>You can also include other information in the email other than errors, i.e. rows affected from a SQL statement and send completion emails. Check out <a href="https://docs.snowflake.com/en/developer-guide/snowflake-scripting/dml-status">this</a> for variables &amp; examples.</p><p>The same can also be done in Snowflake <a href="https://docs.snowflake.com/en/sql-reference/sql/create-task">Tasks</a> using <strong>ERROR_INTEGRATION </strong>and <strong>SUCCESS_INTEGRATION. </strong>But, you would have to create a separate notification integration for each task to customize it.</p><p>For more details, explore the official docs:</p><ul><li><a href="https://docs.snowflake.com/en/user-guide/notifications/email-notifications">Email Notifications</a></li><li><a href="https://docs.snowflake.com/en/sql-reference/snowflake-scripting/exception">Exception Handling in Snowflake Scripting</a></li></ul><p>Happy coding, and may your procedures run smoothly (or at least tell you when they don’t)!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53a2db63de43" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Snowflake Snowsight Lineage: A Game-Changer for Data Visibility]]></title>
            <link>https://medium.com/@akshayrs1993/exploring-snowflake-snowsight-lineage-a-game-changer-for-data-visibility-ca83e9df6419?source=rss-9c113069bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca83e9df6419</guid>
            <category><![CDATA[data-lineage]]></category>
            <category><![CDATA[traceability]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[new-features]]></category>
            <category><![CDATA[observability]]></category>
            <dc:creator><![CDATA[Akshay Rajshekar Shiraguppi]]></dc:creator>
            <pubDate>Mon, 10 Mar 2025 20:48:22 GMT</pubDate>
            <atom:updated>2025-03-10T20:49:15.962Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of modern data management, <strong>understanding data lineage</strong> is crucial for ensuring data accuracy, compliance, and operational efficiency. Snowflake has taken a significant step forward by introducing <strong>Snowsight Lineage</strong>, a powerful feature that provides enhanced visibility into how data flows across your Snowflake environment.</p><h3>What is Snowflake Snowsight Lineage?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JcTO1XlRAlxMeksqkkDlIg.png" /></figure><p><strong>Snowsight Lineage</strong> is a visual representation of the relationships between tables, views, and queries within Snowflake. It allows users to track data movement across their system, making it easier to understand <strong>where data comes from, how it’s transformed, and where it’s used</strong>.</p><p>With this feature, data engineers, analysts, and governance teams can quickly <strong>trace data dependencies, audit data changes, and optimize performance</strong>. It is especially useful for organizations dealing with complex ETL (Extract, Transform, Load) pipelines, regulatory compliance, or debugging data inconsistencies.</p><h3>Key Features of Snowsight Lineage:</h3><ol><li><strong>Visual Data Flow Representation</strong></li></ol><ul><li>The <strong>lineage graph</strong> provides an intuitive, <strong>interactive view</strong> of how data flows from source to destination.</li><li>Users can see the relationships between <strong>tables, views, and queries</strong>.</li></ul><p><strong>2. Query-Level Lineage Tracking</strong></p><ul><li>Provides insights into how data is used in specific queries.</li><li>Helps <strong>identify downstream and upstream dependencies</strong> to assess the impact of changes.</li></ul><p><strong>3. Impact Analysis for Changes</strong></p><ul><li>Before modifying a table or view, users can <strong>analyze how changes might affect dependent objects</strong>.</li><li>Reduces the risk of breaking dashboards, reports, or applications.</li></ul><p><strong>4. Enhanced Data Governance and Compliance</strong></p><ul><li>Ensures transparency in <strong>data transformation and processing</strong>.</li><li>Helps organizations <strong>meet regulatory requirements</strong> by maintaining detailed audit trails.</li></ul><p><strong>5. Performance Optimization</strong></p><ul><li>Identifies redundant queries or <strong>inefficient data transformations</strong>.</li><li>Helps teams streamline data pipelines for <strong>better efficiency</strong>.</li></ul><h3>How to Use Snowsight Lineage?</h3><ol><li><strong>Accessing Lineage in Snowsight: </strong>Navigate to <strong>Snowsight (Snowflake’s web UI)</strong>.Open the <strong>Lineage tab</strong> under the Database Explorer. Select a table or view to <strong>visualize its dependencies</strong>.</li><li><strong>Exploring Upstream and Downstream Dependencies: </strong>Click on a data object to <strong>see where data is sourced from</strong> (upstream). Analyze <strong>which queries, reports, or views depend on this data</strong> (downstream).</li><li><strong>Using Lineage for Debugging and Optimization: </strong>If an <strong>unexpected data issue arises</strong>, use lineage to <strong>trace the source of changes</strong>. Identify <strong>performance bottlenecks</strong> by analyzing query dependencies.</li></ol><h3>Why Snowsight Lineage Matters?</h3><p>Organizations today deal with vast amounts of data, often spread across multiple pipelines and transformations. <strong>Without proper data lineage, teams struggle to track data changes, troubleshoot issues, and ensure compliance</strong>.</p><p>Snowsight Lineage <strong>empowers teams</strong> by providing clear insights into <strong>how data is created, modified, and used</strong> across Snowflake. It’s an essential tool for <strong>data engineers, analysts, and governance teams</strong> who need to maintain control and confidence over their data assets.</p><h3><strong>Final Thoughts</strong></h3><p>With Snowsight Lineage, Snowflake continues to enhance its capabilities in <strong>data observability and governance</strong>. Whether you’re a <strong>data engineer managing transformations, an analyst ensuring accuracy, or a compliance officer tracking regulatory requirements</strong>, Snowsight Lineage makes data transparency and tracking easier than ever.</p><p>Want to dive deeper? Check out the official <a href="https://docs.snowflake.com/en/user-guide/ui-snowsight-lineage">Snowflake Snowsight Lineage documentation</a> for step-by-step guides and best practices.</p><p>Let me know your thoughts! How do you see <strong>data lineage improving your workflows</strong> in Snowflake? 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca83e9df6419" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[❄️Snowflake blocking Single-Factor Password Authentication and how organization can prepare for…]]></title>
            <link>https://medium.com/@akshayrs1993/%EF%B8%8Fsnowflake-blocking-single-factor-password-authentication-and-how-organization-can-prepare-for-0fe8801b6168?source=rss-9c113069bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/0fe8801b6168</guid>
            <category><![CDATA[sso]]></category>
            <category><![CDATA[snowflake-security]]></category>
            <category><![CDATA[202408bundle]]></category>
            <category><![CDATA[oauth]]></category>
            <category><![CDATA[mfa]]></category>
            <dc:creator><![CDATA[Akshay Rajshekar Shiraguppi]]></dc:creator>
            <pubDate>Thu, 06 Feb 2025 01:39:03 GMT</pubDate>
            <atom:updated>2025-05-29T17:02:45.672Z</atom:updated>
            <content:encoded><![CDATA[<h3>❄️Snowflake blocking <strong>Single-Factor Password Authentication and how organization can prepare for the change</strong>❄️</h3><p>Snowflake announced in 2024 that they would be enforcing MFA, redefining password based authentication and other security updates as they signed Cybersecurity and Infrastructure Security Agency (CISA).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*NRMAM3xY6b9nSTzuYiWtGA.png" /></figure><p>If you have been using Snowflake before 2020 then there is a good chance that you might not be aware that you can set a <a href="https://docs.snowflake.com/en/sql-reference/sql/create-user">type </a>for every user. Regardless, it’s time to revisit and redefine this more appropriately in 2025 due to upcoming updates in 2025.</p><p>Below is the new flow for authentication that is recommended by snowflake:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6UDnJJxLnvCQCJOCeNrQ9A.png" /></figure><p>Snowflake currently offer 3 user types:(*LEGACY_SERVICE will be deprecated soon)</p><ol><li>PERSON: This user type is assigned to humans who login in through Snowsight. (If you are logging in via third party database management tools then you would need to make sure you set it to SSO). Any NULLS in user type are defaulted to person.</li><li>SERVICE: This user type is assigned to non humans which are primarily used by other applications or services that connect to snowflake.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*0Gm02E1lTP0J9tyra-me2Q.png" /><figcaption>SERVICE USERS CHARACTERISTICS</figcaption></figure><p>3. LEGACY_SERVICE: This user type is assigned is similar to SERVICE except it mainly allows password authentication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*AMK_0PdXPtcbhKCDNb2hRw.png" /><figcaption>LEGACY_SERVICE USERS CHARACTERISTICS</figcaption></figure><p>Steps to take to be prepared:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*VW765Pleh8-pCEGBElvGzA.png" /></figure><p>1. List all users and their type. <br>Find out if the user is a human or service and all the applications using it. Find out how they are authenticating to snowflake.<br>Following users need to be checked upon if a human isn’t associated with it:</p><pre>SELECT name, type, disabled, has_password<br>FROM snowflake.account_usage.users<br>WHERE deleted_on IS NULL AND DISABLED=FALSE AND has_password<br>AND (type IS NULL OR type = &#39;PERSON&#39;);</pre><p>2. Establish/Acknowledge using MFA or SSO for human users by <strong>April 2025*</strong>.<br> Check <a href="https://docs.snowflake.com/en/developer-guide/node-js/nodejs-driver-authenticate">here </a>for more.</p><blockquote>If you are not ready for this update then you may create a <a href="https://docs.snowflake.com/en/user-guide/authentication-policies?_ga=2.19232696.1014041387.1738781399-664955179.1735836546&amp;_gac=1.246550192.1738004825.EAIaIQobChMI3qv7n8yWiwMVjA9ECB2KcxMLEAAYASAAEgL1K_D_BwE">custom authentication policy </a>or set the type to LEGACY_SERVICE for time being. <br>Custom authentication policy for human types allows you to use passwords until August 2025 only. LEGACY_SERVICE usage is valid until Nov 2025 only.</blockquote><p>3. Establish/Acknowledge using short-lived credentials, such as <a href="https://docs.snowflake.com/en/user-guide/oauth-intro?_fsi=shkRdEpb&amp;_ga=2.131061391.1014041387.1738781399-664955179.1735836546&amp;_gac=1.217196834.1738004825.EAIaIQobChMI3qv7n8yWiwMVjA9ECB2KcxMLEAAYASAAEgL1K_D_BwE">OAuth</a>, whenever possible and for longer-term credentials, such as <a href="https://docs.snowflake.com/en/user-guide/key-pair-auth">key pairs</a>. Rotate those keys regularly and combine them with network policies whenever possible. All this needs to be done by <strong>November 2025*</strong>. Check <a href="https://community.snowflake.com/s/article/HOW-TO-OAUTH-TOKEN-GENERATION-USING-SNOWFLAKE-CUSTOM-OAUTH">this</a> to use snowflake OAuth that does not involve third party OAuth services.</p><p>Ex: Snowsql, Snowflake CLI, Tableau/Power BI, Data Integration tools, Dbt &amp; others</p><p>4. For testing, you can use <a href="https://docs.snowflake.com/en/sql-reference/functions/system_disable_behavior_change_bundle">SYSTEM$DISABLE_BEHAVIOR_CHANGE_BUNDLE</a> to enable/disable the upcoming bundle <a href="https://docs.snowflake.com/en/release-notes/bcr-bundles/2024_08_bundle">2024_08_bundle</a> prior to 8 weeks of release.</p><blockquote>The behavior change release process at Snowflake lets Snowflake users control a bundle of product or feature changes that may affect existing functionality for at least eight weeks before the changes are generally enabled across all Snowflake accounts. During this period of time, account administrators can selectively disable or enable each bundle of behavior changes. New behavior change bundles are introduced on a monthly basis.</blockquote><p>Other considerations to take to increase security:<br>1. <a href="https://docs.snowflake.com/en/user-guide/network-policies"><em>Network policies</em></a><em> to make sure your users and services are coming from only authorized and trusted sources whenever that is possible. <br>2. </em><a href="https://docs.snowflake.com/en/user-guide/authentication-policies"><em>Authentication policies</em></a><em> to enforce strong authentication methods that leverage short-lived credentials like OAuth and SAML. <br>2. </em><a href="https://docs.snowflake.com/en/user-guide/admin-user-management#label-password-policy-best-practices"><em>Password policies</em></a><em> to enforce the organization’s password policies. <br>3. </em><a href="https://docs.snowflake.com/en/user-guide/admin-user-management#label-password-policy-best-practices"><em>Session policies</em></a><em> to limit idle session times.<br>4. Use snowflake </em><a href="https://docs.snowflake.com/en/user-guide/trust-center/overview#label-threat-intelligence-scanner-package"><em>scanners </em></a><em>to detect risky users.<br>5. </em><a href="https://docs.snowflake.com/en/user-guide/leaked-password-protection"><em>Leaked passwords</em></a><em> monitoring.</em></p><p>Read this <a href="https://www.snowflake.com/en/blog/blocking-single-factor-password-authentification/">official post</a>* by snowflake to know more about this update.</p><p>❄️I hope this helps in understanding the upcoming changes. Feel free to reach out to me if you have any questions.❄️</p><ul><li>NOTE: PLEASE NOTE THAT THE TIMELINES HAVE CHANGED SINCE THIS BLOG WAS POSTED. PLEASE REFER TO <a href="https://docs.snowflake.com/en/user-guide/security-mfa-rollout#deprecation-timeline">THIS</a>.</li><li>NOTE: As of April 2025, Snowflake supports PAT(Personal Access Tokens) authentication and this may be the better option per use case. Read <a href="https://docs.snowflake.com/en/user-guide/programmatic-access-tokens">this</a>.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0fe8801b6168" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is Airflow really required?]]></title>
            <link>https://medium.com/@akshayrs1993/power-of-sql-server-agent-virtually-run-any-processes-including-snowflake-python-85c1be9485b7?source=rss-9c113069bbda------2</link>
            <guid isPermaLink="false">https://medium.com/p/85c1be9485b7</guid>
            <category><![CDATA[sql-server-agent]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[scheduling]]></category>
            <category><![CDATA[airflow]]></category>
            <dc:creator><![CDATA[Akshay Rajshekar Shiraguppi]]></dc:creator>
            <pubDate>Tue, 18 Jun 2024 17:57:34 GMT</pubDate>
            <atom:updated>2025-11-18T23:25:49.869Z</atom:updated>
            <content:encoded><![CDATA[<h3>Is Airflow really required? Unleashing the power of SQL Server Agent: Virtually schedule any processes (including Snowflake &amp; Python)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*XT8ehB35ujaFhOwe9_LtVQ.png" /></figure><p>SQL Server Agent is a powerful tool in Microsoft SQL Server for automating and managing various administrative tasks. Today, Airflow is one of the most popular scheduling and monitoring tool for tasks/processes (Here is the <a href="https://airflow.apache.org/use-cases/">link </a>to know more about it). While I admire the open source air flow, it may not be necessary in all cases and you might end up using multiple tools doing the same thing.</p><p>In this article, I want to show that SQL server’s SQL Agent can be used for scheduling and monitoring many codes/processes not specific to SQL Server. This can even run tasks in parallel or sequential. You can even create dependencies between tasks too. There is no need of writing python code/using cron like Airflow as SQL Agent has a real good UI to do this. For SQL server users, this might eliminate the need of getting a standalone scheduler.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/0*ljVUUpgyKKeQKBEg.png" /></figure><p>Before that, here is the list of features of SQL Server Agent:- (To learn more <a href="https://learn.microsoft.com/en-us/sql/ssms/agent/sql-server-agent?view=sql-server-ver16">visit </a>this link)</p><ol><li>Job Scheduling and Automation</li><li>Alerting and Monitoring</li><li>Database Maintenance</li><li>Data Integration and ETL Processes</li><li>Monitoring and Logging</li><li>Custom Automation</li><li>Resource Management</li></ol><p>Now, the one amazing capability of SQL Agent is that you can run/schedule command prompt commands.</p><blockquote>This opens up the door of possibilities.</blockquote><p>Here are some of the non SQL Server processes/tasks you can automate:</p><p>1. Snowflake processes: <br>From PUT/COPY to cloning using snowsql + command prompt. You can automate loads, scripts and schedule virtually any activity in snowflake that can be done via snowsql (This <a href="https://docs.snowflake.com/en/user-guide/snowsql-use">link </a>gives more info of snowsql capability).<br>Here is an example of running a sql script using snowsql in SQL Agent:</p><figure><img alt="SQL Agent running snowsql script using command prompt" src="https://cdn-images-1.medium.com/max/485/1*Rth1Ybh54p_JdFeZ1TrM4A.png" /></figure><p>2. Tableau operations: <br>From refreshing extracts/data sources to creating users using ‘tabcmd + command prompt’. One use case can be that it can be used to trigger any refreshes after a load is completed (Here is the <a href="https://help.tableau.com/current/server/en-us/tabcmd_cmd.htm">link </a>that gives more info of tabcmd capability).</p><p>Here is an example of running a refresh extract command script in SQL Agent :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*SOPz2bnggT6GfNcsTZC2RA.png" /></figure><p>3. Python scripts:<br>Running/scheduling python scripts can be real simple here. You can even specify environments or run without use anaconda.</p><p>Here is an example of it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*h2-H5fIEs2O60b3GbJnPEQ.png" /></figure><p>4. Windows processes/tasks:<br>You can run any windows tasks.</p><p>Here is an example where it deletes files in a folder which are older than 30 days:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*PuHU543LDTrMOnzvHrZLyA.png" /></figure><p>5. Application hosting: You can even go as far as hosting a python application. Note: It may not be recommended to do it, especially, if its a high traffic production app but it’s an option. I currently use it for POC/testing.</p><p>6. Miscellaneous: Any windows tasks or processes that can be run via command prompt. You can even create windows batch scripts and schedule them in SQL Agent.</p><p>To conclude, While tools like Airflow are good options for running/scheduling tasks/processes, SQL Agent is a really good alternative especially if your organization already uses SQL Server and you are not a fan of writing python code to schedule tasks (like in airflow).</p><p>There are some drawbacks of SQL Agent (as there is for any tool) especially when it comes to error handling. However, this can be handled by using ‘SSIS with Execute process task’ (and also have the DAG like setup) instead to do all the above but that’s a discussion for another day.</p><p><em>Please feel free to reach out to me at akshayrs1993@gmail.com if you have any questions or need guidance.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85c1be9485b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>