<?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 Milind Chaudhari on Medium]]></title>
        <description><![CDATA[Stories by Milind Chaudhari on Medium]]></description>
        <link>https://medium.com/@milind270989?source=rss-39f64a3e8c03------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wu0JixfgXIksW5sxRZpDGg.jpeg</url>
            <title>Stories by Milind Chaudhari on Medium</title>
            <link>https://medium.com/@milind270989?source=rss-39f64a3e8c03------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 06:55:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@milind270989/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[AI_GENERATE_TABLE_DESC : AI Powered approach to generate automated object descriptions]]></title>
            <link>https://medium.com/snowflake/ai-generate-table-desc-ai-powered-approach-to-generate-automated-object-descriptions-9db8b0e86801?source=rss-39f64a3e8c03------2</link>
            <guid isPermaLink="false">https://medium.com/p/9db8b0e86801</guid>
            <category><![CDATA[snowflake-cortex]]></category>
            <category><![CDATA[data-governance]]></category>
            <category><![CDATA[snowflake-cortex-ai]]></category>
            <category><![CDATA[snowpark-python]]></category>
            <dc:creator><![CDATA[Milind Chaudhari]]></dc:creator>
            <pubDate>Wed, 05 Nov 2025 15:02:57 GMT</pubDate>
            <atom:updated>2025-11-05T15:02:57.378Z</atom:updated>
            <content:encoded><![CDATA[<h3>AI_GENERATE_TABLE_DESC : AI Powered approach to generate automated object descriptions</h3><h3>Introduction</h3><p>In the modern data landscape, the speed of data generation often outpaces our ability to document it. This documentation debt creates a significant barrier to data discovery, usability, and governance. Analysts and data scientists spend an inordinate amount of time trying to understand what data exists and what it means, rather than deriving insights from it. Recognizing this challenge, Snowflake has introduced a powerful feature within its Horizon catalog: AI_GENERATE_TABLE_DESC. This stored procedure leverages Snowflake Cortex to automatically generate plain-English descriptions for tables, columns &amp; views, promising to eliminate the manual toil of data cataloging.</p><h3><strong>Why AI_GENERATE_TABLE_DESC Is a Game Changer</strong></h3><p>The native AI_GENERATE_TABLE_DESC stored procedure is a transformative step forward for data management within Snowflake. It directly addresses one of the most persistent and time-consuming challenges faced by data teams: creating and maintaining comprehensive documentation.</p><p>At its core, the feature uses Snowflake-hosted LLMs to analyze a table’s metadata and, optionally, sample its data to produce high-quality, human-readable descriptions. This capability is a game changer for several reasons:</p><ol><li><strong>Drastic Reduction in Manual Effort:</strong> Traditionally, documenting a new database with hundreds of tables and thousands of columns is a monumental task requiring countless hours of manual input from data engineers and analysts. AI_GENERATE_TABLE_DESC automates this process, allowing teams to generate baseline documentation for an entire schema in minutes, not months.</li><li><strong>Improved Data Discoverability:</strong> An undocumented table is an invisible asset. By automatically populating table and column comments, the feature makes data assets immediately more discoverable through Snowflake’s INFORMATION_SCHEMA, Snowsight UI, and third-party data catalog tools. This empowers users across the organization to find and understand the data they need without relying on institutional knowledge.</li><li><strong>Democratization of Data Understanding:</strong> The descriptions generated by the AI are in natural language, making complex table structures and cryptic column names understandable to a broader, less technical audience. This helps bridge the gap between data teams and business users, fostering a more data-literate culture.</li><li><strong>Seamless Integration:</strong> As a native SQL stored procedure, it integrates directly into existing data workflows. It can be called from scripts, scheduled tasks, or other stored procedures, making it easy to incorporate into CI/CD pipelines for data or routine maintenance schedules.</li></ol><p>By embedding this intelligence directly into the database, Snowflake has turned data documentation from a reactive, manual chore into a proactive, automated capability, fundamentally changing how organizations manage and interact with their data assets.</p><h3>Git Link for Code Base</h3><p>The complete Snowflake SQL Scripting code for the intelligent stored procedure, along with setup and testing scripts, is available at the following GitHub repository:</p><p><a href="https://github.com/milind-data-engineering/snowflake_horizon_catalog">https://github.com/milind-data-engineering/snowflake_horizon_catalog</a></p><h3>Advantages of the Intelligent Codebase over Native AI_GENERATE_TABLE_DESC</h3><p>The provided codebase is not a replacement for the native function but rather a smart controller that optimizes its use for cost, stability, and governance. Its advantages are significant:</p><p><strong>1. Strategic Cost Optimization</strong></p><p>The most immediate benefit is a dramatic reduction in operational costs. The native AI function’s pricing model includes not only warehouse compute but also a separate charge for “AI Services,” which is based on the number of tokens processed by the LLM. The intelligent procedure implements a crucial “check-before-you-call” logic:</p><ul><li><strong>Avoids Redundant AI Calls:</strong> Before invoking the AI_GENERATE_TABLE_DESC function, the procedure first queries the INFORMATION_SCHEMA to see if a table and all its columns already have comments. If the object descriptions already exists, the AI call is skipped entirely for that table. For a mature schema where 90% of tables are already documented, this translates to a 90% reduction in AI service credits on each scheduled run.</li><li><strong>Minimizes Wasteful Compute:</strong> By skipping unnecessary AI calls, the procedure also reduces the warehouse compute time needed to execute the documentation workflow.</li></ul><p>This approach transforms the documentation process from a fixed, recurring expense into a marginal cost that is only incurred when new, undocumented assets are introduced.</p><p><strong>2. Preservation of Curated Metadata and Governance</strong></p><p>Data governance often requires precise, carefully worded descriptions, especially for columns containing Personally Identifiable Information (PII), financial data, or other sensitive information. A data steward may have written a specific comment for compliance or clarity that should never be altered by an automated process. The intelligent procedure ensures this by:</p><ul><li><strong>Respecting Existing Comments:</strong> The script is designed to be non-destructive. If a comment already exists on a table or a specific column, the procedure will not generate an ALTER statement to overwrite it. It only fills in the blanks where comments are NULL.</li><li><strong>Ensuring Idempotency:</strong> This non-destructive behavior makes the procedure idempotent. Running it multiple times on the same schema will produce the exact same result without causing constant, unnecessary updates. This stability is critical for maintaining a trustworthy and reliable data catalog. It prevents the “comment drift” that could occur if a non-deterministic LLM were allowed to regenerate descriptions on every run.</li></ul><p><strong>3. Surgical and Efficient Updates</strong></p><p>The procedure operates with surgical precision. It understands that a table’s documentation status is not binary. A table might have a perfect, human-written description, but a few of its columns might be undocumented. In this scenario, the script is smart enough to:</p><ul><li>Identify the specific columns that lack comments.</li><li>Invoke AI_GENERATE_TABLE_DESC once to get descriptions for all objects in the table.</li><li>Selectively apply comments <em>only</em> to the columns that were originally missing them, leaving the existing table comment and other column comments untouched.</li></ul><p>This surgical approach ensures maximum efficiency and minimal interference, augmenting human efforts rather than overriding them. It fosters a hybrid intelligence model where AI handles the scale of documentation, and human experts provide the critical nuance and context where it matters most.</p><h3>Conclusion</h3><p>Snowflake’s AI_GENERATE_TABLE_DESC is a landmark feature that powerfully addresses the age-old problem of data documentation.</p><p>The stored procedure presented here handles crucial scenarios for enterprises. By intelligently checking the existing state of documentation before invoking AI services, it delivers massive cost savings, especially in mature data environments. By respecting and preserving human-curated comments, it ensures the integrity of the data catalog and supports critical governance requirements. This approach transforms the raw power of AI into a smart, sustainable, and safe process for building a self-maintaining data catalog. For any organization looking to leverage Snowflake’s AI capabilities at scale, adopting such an intelligent wrapper is not just a best practice — it is essential for long-term success and financial prudence.</p><h4>References:</h4><ol><li>AI_GENERATE_TABLE_DESC — Snowflake Documentation, accessed October 17, 2025, <a href="https://docs.snowflake.com/en/sql-reference/stored-procedures/ai_generate_table_desc">https://docs.snowflake.com/en/sql-reference/stored-procedures/ai_generate_table_desc</a></li><li>Using SQL to automatically generate object descriptions | Snowflake Documentation, accessed October 17, 2025, <a href="https://docs.snowflake.com/en/user-guide/sql-cortex-descriptions">https://docs.snowflake.com/en/user-guide/sql-cortex-descriptions</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9db8b0e86801" width="1" height="1" alt=""><hr><p><a href="https://medium.com/snowflake/ai-generate-table-desc-ai-powered-approach-to-generate-automated-object-descriptions-9db8b0e86801">AI_GENERATE_TABLE_DESC : AI Powered approach to generate automated object descriptions</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[Talking to Your Receipts: A Case Study in AI Product Thinking]]></title>
            <link>https://medium.com/@milind270989/talking-to-your-receipts-a-case-study-in-ai-product-thinking-00c1713064ee?source=rss-39f64a3e8c03------2</link>
            <guid isPermaLink="false">https://medium.com/p/00c1713064ee</guid>
            <dc:creator><![CDATA[Milind Chaudhari]]></dc:creator>
            <pubDate>Mon, 18 Aug 2025 00:07:52 GMT</pubDate>
            <atom:updated>2025-08-18T00:07:52.775Z</atom:updated>
            <content:encoded><![CDATA[<p>With the recent advancements in AI, building a product prototype has become easier than ever. Platforms like Gemini, ChatGPT, and Perplexity have given every individual access to superhuman capabilities. Add no-code IDEs like Cursor, Replit, and Lovable, and that power multiplies dramatically.</p><p>In an era where <em>anyone</em> can build a product, the real differentiator is no longer <em>how</em> to build — but <em>what</em> to build.</p><p>The more progress I see in the AI space, the stronger my belief that the future will reward product thinkers and builders. Taking a step in that direction, I’d like to share a problem I explored and how I approached it from a product-thinking perspective.</p><h3>The Problem</h3><p>When grocery shopping, a few common questions often come up:</p><ul><li>How much did we spend on apples the last time we were here?</li><li>What items did we purchase during our last visit?</li><li>Is there a way to compare which store offers better prices?<br> <em>For example: apples might be cheaper at Walmart, while peaches cost less at Whole Foods.</em></li></ul><p>The application can also be extended to tax filings, house maintenance receipts/bills, etc but let’s just focus on grocery receipts.</p><h3>The Current Market</h3><p>Today’s solutions don’t quite solve this. Most tools focus on accountants, small business owners, or corporate expense tracking — think Expensify or SparkReceipt. What’s missing is a simple way for everyday users to interact with their personal receipts in a natural, conversational manner.</p><h3>The Proposed Idea</h3><p>Now, imagine a web or mobile app where you can:</p><ol><li>Upload your receipts effortlessly.</li><li>Have them automatically categorized and organized.</li><li>Simply <em>talk</em> to your receipts through a conversational interface.</li><li>Understand how inflation hits your core grocery expenses YoY or MoM</li></ol><p>Want to know how much you spent on fruit last month? Or whether milk is cheaper at Costco versus Trader Joe’s? Just ask.</p><h3>Closing Thoughts</h3><p>This is how I approach product thinking: start with a real, everyday problem, study the gaps in current market solutions, and then imagine a simpler, smarter way to solve it using today’s AI capabilities. In my upcoming articles, I’ll share how to take this idea further — first by prototyping it, then deploying it on the cloud. As the concept matures, I also plan to run a beta test of the app to gather real-world feedback before release.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=00c1713064ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Working Around Account Admin Privileges in Snowflake]]></title>
            <link>https://medium.com/@milind270989/working-around-account-admin-privileges-in-snowflake-61cc9d3ac9df?source=rss-39f64a3e8c03------2</link>
            <guid isPermaLink="false">https://medium.com/p/61cc9d3ac9df</guid>
            <category><![CDATA[enablement]]></category>
            <category><![CDATA[snowflake-computing]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[how-to]]></category>
            <category><![CDATA[snowflake]]></category>
            <dc:creator><![CDATA[Milind Chaudhari]]></dc:creator>
            <pubDate>Fri, 22 Apr 2022 15:44:55 GMT</pubDate>
            <atom:updated>2022-04-22T15:46:48.167Z</atom:updated>
            <content:encoded><![CDATA[<h4>A guide to finding all users and their associated roles in Snowflake without using account admin privileges</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HUvSrPIqJk74ksdQ" /><figcaption>Photo by <a href="https://unsplash.com/@ricaros?utm_source=medium&amp;utm_medium=referral">Danial Igdery</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Snowflake has been a dominant market player when it comes to cloud data warehousing. It’s micro-partition architecture coupled with easy-to-use features — such as zero-copy clone, snowpipes, streams, and tasks — make it a great choice for cloud data warehouse activities.</p><p>Recently while working for a client, I came across a scenario where I had to quickly provide a list of all users and their allocated roles to one of the architects. While this might sound easy to address, the real issue was that no one on our team had account admin privileges, meaning Snowflake’s database wasn’t accessible to us. However, we had security admin privileges and found a couple of different ways to approach the problem, which I’ve outlined below.</p><h3>Our automated approach</h3><p>When scheduled and monitored, the automated approach ensures no users are granted privileges that they shouldn’t have on Snowflake. This is particularly helpful as you onboard more users to Snowflake.</p><h4>Step one:</h4><p>Our security admin role already had access to a warehouse and a database. If you don’t have access to any warehouse or database, ask your account admin to either allocate usage privileges on any existing warehouse and database to a security admin role or grant the below privileges:</p><ol><li>USE ROLE ACCOUNTADMIN;</li><li>GRANT CREATE WAREHOUSE ON ACCOUNT TO ROLE SECURITYADMIN;</li><li>GRANT CREATE DATABASE ON ACCOUNT TO ROLE SECURITYADMIN;</li></ol><h4>Step two:</h4><p>You can create a new warehouse or simply use an existing one. I created a new warehouse (i.e., SAMPLE_COMPUTE) for demo purposes.</p><h4>Step three:</h4><p>Create a database and two permanent tables:</p><ol><li>USE ROLE SECURITYADMIN;</li><li>USE WAREHOUSE SAMPLE_COMPUTE;</li><li>CREATE DATABASE TEMP_DB;</li><li>CREATE TABLE if not exists user_roles<br>(<br>roles varchar(100),<br>grantee_name varchar(100),<br>granted_by varchar(100)<br>);</li><li>CREATE TABLE if not exists all_users_stm<br>(<br>username varchar(1000)<br>);</li></ol><h4>Step four:</h4><p>Create the Snowflake stored procedure from <a href="https://github.com/milind-data-engineering/snowflake/blob/main/sp_find_users_and_roles">this Github repository</a>.</p><h4>Step five:</h4><p>Any time someone needs a list of users and their roles, run the below stored procedure:<br>call sp_find_users_and_roles()</p><p>You can download the data or provide the table access to the user for reference.</p><h3>Our manual approach</h3><p>Having an automated way to find users and their roles using a Snowflake-stored procedure is useful in many cases, but there are scenarios where you might simply need the report for a one-time activity. In these cases, we would manually create a temporary table so that the data isn’t persistent.</p><h4>Step one:</h4><p>Use an existing warehouse or database, or create one before proceeding. Then set Snowflake context using:</p><ol><li>USE ROLE SECURITYADMIN;</li><li>USE WAREHOUSE SAMPLE_COMPUTE;</li><li>USE DATABASE TEMP_DB;<br>CREATE TEMPORARY TABLE if not exists user_roles<br>(<br>roles varchar(100),<br>grantee_name varchar(100),<br>granted_by varchar(100)<br>);</li></ol><h4>Step two:</h4><ol><li>show users;<br>select listagg(‘show grants to user ‘||”name”|| ‘;’ || ‘\n’ ||’insert into user_roles select ‘|| ‘“role”,”grantee_name”,”granted_by”’||<br>‘ from table(result_scan(-1));’,’\n’)<br>from table(result_scan(-1));</li></ol><p>Basically, for every user in the account, we want to generate the below sample statements:</p><p>show grants to user USER1;insert into user_roles select<br> “role”,”grantee_name”,”granted_by” from table(result_scan(-1));show grants to user USER2;insert into user_roles select “role”,”grantee_name”,”granted_by” from table(result_scan(-1));</p><p>So, if you have 100 users, then you would have 100 such statements. RESULT_SCAN(-1) ensures that Snowflake captures results from the last executed query. So for every user, we will show their grants and then capture them into a table.</p><h4>Step three:</h4><p>Click on the query output in Snowflake UI and click the “copy” button, then paste the content and execute all of these statements together.</p><h4>Step four:</h4><p>Verify the table ‘user_roles’ and download the data to share. Remember that it’s a temporary table, so you can’t check it in another Snowflake session.</p><h3>Conclusion</h3><p>Often IT architects, admins, or IT security teams will need to revisit the users and their allocated roles to ensure that users don’t have privileges to a specific role they shouldn’t have access to. This is pivotal for ensuring the security of your Snowflake environment.</p><p><em>Slalom is a global consulting firm focused on strategy, technology, and business transformation. </em><a href="https://www.slalom.com/what-we-do"><em>Learn more and reach out today.</em></a></p><p><em>Found this article useful? Hit that clap button. Really like it? Hold the clap, give it two, or fifty!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61cc9d3ac9df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Snowflake : To fetch all users and their associated roles without using ACCOUNTADMIN privileges in…]]></title>
            <link>https://medium.com/@milind270989/snowflake-to-fetch-all-users-and-their-associated-roles-without-using-accountadmin-privileges-in-e5d6733ddf5b?source=rss-39f64a3e8c03------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5d6733ddf5b</guid>
            <category><![CDATA[roles]]></category>
            <category><![CDATA[users]]></category>
            <category><![CDATA[cloud-data-warehouse]]></category>
            <category><![CDATA[snowflake]]></category>
            <dc:creator><![CDATA[Milind Chaudhari]]></dc:creator>
            <pubDate>Wed, 02 Feb 2022 04:01:57 GMT</pubDate>
            <atom:updated>2022-02-02T04:33:46.987Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Snowflake : To fetch all users and their associated roles without using ACCOUNTADMIN privileges in a manual way</strong></h3><p>In my last article; we saw how we can automate fetching users and their roles using a snowflake stored procedure. If you want an automated way; then switch back to the below article:</p><p><a href="https://medium.com/@milind270989/snowflake-to-fetch-all-users-and-their-roles-allocated-to-them-ad7ea34fb8d9">Snowflake : To fetch all users and their roles allocated to them</a></p><p>But there are scenarios; when someone just needs this data for one-time activity. In that case; we would just create a temporary table so that the data is not persistent.</p><p><strong>a) Purpose:</strong></p><p>When we don’t have ACCOUNTADMIN privileges; fetching all users and their associated roles can be a challenge. We faced a similar issue and since we had SECURITYADMIN privileges; we were able to create a manual and automated process. Below we will only discuss the manual way.</p><p>Let’s get started</p><p><strong>b) Approach:</strong></p><p>Step 1: Set snowflake context using:</p><blockquote>USE ROLE SECURITYADMIN;</blockquote><blockquote>USE WAREHOUSE SAMPLE_COMPUTE;</blockquote><blockquote>USE DATABASE TEMP_DB;</blockquote><blockquote>CREATE TEMPORARY TABLE if not exists user_roles<br>(<br> roles varchar(100),<br> grantee_name varchar(100),<br> granted_by varchar(100)<br>);</blockquote><p>[Note: If you don’t have a valid warehouse or database; then create one before proceeding or you can use any existing warehouse or database]</p><p>Step 2:</p><blockquote>show users;</blockquote><blockquote>select listagg(‘show grants to user ‘||”name”|| ‘;’ || ‘\n’ ||’insert into user_roles select ‘|| ‘“role”,”grantee_name”,”granted_by”’||<br>‘ from table(result_scan(-1));’,’\n’)<br>from table(result_scan(-1));</blockquote><p>Let me explain what we are trying to do.</p><p>Basically for every user in the account; we want to generate the below sample statements:</p><blockquote>show grants to user USER1;insert into user_roles select “role”,”grantee_name”,”granted_by” from table(result_scan(-1));</blockquote><blockquote>show grants to user USER2;insert into user_roles select “role”,”grantee_name”,”granted_by” from table(result_scan(-1));</blockquote><p>So if you have 100 users; then you would have 100 such statements. RESULT_SCAN(-1) ensures that Snowflake captures results from the last executed query. So in short; for every user we will show their grants and then capture them into a table. Easy; right??</p><p>Step 3: Click on the query output in Snowflake UI. Click Copy Button. Paste the content which is copied and then execute all these statements together.</p><p>Step 4: Verify the table ‘user_roles’ and then you can download the data and share it across.</p><p>[Note: Remember; it’s a temporary table so you can’t check the data in another Snowflake session]</p><p>Do comment in case you have any difficulties. In the mean time; stay tuned for further Snowflake articles.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5d6733ddf5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Snowflake : To fetch all users and their roles allocated to them]]></title>
            <link>https://medium.com/@milind270989/snowflake-to-fetch-all-users-and-their-roles-allocated-to-them-ad7ea34fb8d9?source=rss-39f64a3e8c03------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad7ea34fb8d9</guid>
            <category><![CDATA[roles]]></category>
            <category><![CDATA[users]]></category>
            <category><![CDATA[cloud-data-warehouse]]></category>
            <category><![CDATA[snowflake]]></category>
            <dc:creator><![CDATA[Milind Chaudhari]]></dc:creator>
            <pubDate>Mon, 24 Jan 2022 21:47:27 GMT</pubDate>
            <atom:updated>2022-02-02T04:42:39.768Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Snowflake : To fetch all users and their associated roles without using ACCOUNTADMIN privileges in an automated way</strong></h3><p><strong>a) Introduction:</strong></p><p>Snowflake has been a dominant market player when it comes to cloud data warehousing. It’s micro-partition architecture coupled with some easy to use features (zero-copy clone, snowpipes, streams, tasks, etc) makes it a great choice for cloud data warehouse activities.</p><p><strong>b) Purpose:</strong></p><p>Recently while working for a client; I came across a scenario where I had to quickly provide a list of all users and their roles allocated to them to one of the architects. The problem sounds easy right? But the real issue was our entire team didn’t have ACCOUNTADMIN privileges due to which snowflake db wasn’t accessible to us. However; we had SECURITYADMIN privileges. So after some digging; we came across an approach which I have described below.</p><p>[Note: This is entirely our approach and there maybe multiple ways of approaching the same issue]</p><p><strong>c) Approach:</strong></p><p><strong>Step 1:</strong> Our SECURITYADMIN role already had access to a warehouse and a database. In case; you don’t have access to any warehouse or db; then ask your ACCOUNTADMIN to either allocate usage privileges on any existing warehouse and database to SECURITYADMIN role or grant the below privileges:</p><p>USE ROLE ACCOUNTADMIN;<br>GRANT CREATE WAREHOUSE ON ACCOUNT TO ROLE SECURITYADMIN;</p><p>GRANT CREATE DATABASE ON ACCOUNT TO ROLE SECURITYADMIN;</p><p><strong>Step 2:</strong></p><p>Create a new warehouse or you can use any existing one. I am creating a new warehouse i.e SAMPLE_COMPUTE for demo purposes</p><p><strong>Step 3</strong>: Create a db and 2 permanent tables</p><p>USE ROLE SECURITYADMIN;<br>USE WAREHOUSE SAMPLE_COMPUTE;<br>CREATE DATABASE TEMP_DB;</p><p>CREATE TABLE if not exists user_roles<br>(<br> roles varchar(100),<br> grantee_name varchar(100),<br> granted_by varchar(100)<br>);</p><p>CREATE TABLE if not exists all_users_stm<br>(<br> username varchar(1000);<br>);</p><p><strong>Step 4:</strong> Create the Snowflake stored procedure from the below repo:</p><p><a href="https://github.com/milind-data-engineering/snowflake/blob/main/sp_find_users_and_roles">https://github.com/milind-data-engineering/snowflake/blob/main/sp_find_users_and_roles</a></p><p><strong>Step 5:</strong> Call the snowflake stored procedure using</p><p>call sp_find_users_and_roles()</p><p>[Note: Each time anyone needs a list of users and their roles; just run this stored procedure and you should be good. You can download the data or just provide the table access to the concerned role/user for their reference]</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad7ea34fb8d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>