<?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 Sujit Yadav on Medium]]></title>
        <description><![CDATA[Stories by Sujit Yadav on Medium]]></description>
        <link>https://medium.com/@sujityadav99?source=rss-728631a1cdcb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*6ws0atitifklh6cl</url>
            <title>Stories by Sujit Yadav on Medium</title>
            <link>https://medium.com/@sujityadav99?source=rss-728631a1cdcb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 21:44:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sujityadav99/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[Data Quality Monitoring in Snowflake: A Practical Guide for Data Teams]]></title>
            <link>https://medium.com/@sujityadav99/data-quality-monitoring-in-snowflake-a-practical-guide-for-data-teams-d064e0a95931?source=rss-728631a1cdcb------2</link>
            <guid isPermaLink="false">https://medium.com/p/d064e0a95931</guid>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[data-monitoring]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-observability]]></category>
            <category><![CDATA[data-quality]]></category>
            <dc:creator><![CDATA[Sujit Yadav]]></dc:creator>
            <pubDate>Wed, 19 Aug 2026 05:56:33 GMT</pubDate>
            <atom:updated>2026-08-19T05:56:33.318Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Your tables look fine until they don’t. Here’s how to catch problems before your stakeholders do.</strong></p><p><em>Estimated read time: 8 minutes</em></p><p><strong>The Problem Every Data Team Faces</strong></p><p>You’ve built pipelines. You’ve set up orchestration. Data flows from source to warehouse like clockwork. Then one Monday morning, your VP of Sales asks why the revenue dashboard shows negative numbers. Your finance team flags duplicate transactions. Your ML model starts producing garbage predictions because 40% of a critical column went NULL over the weekend.</p><p>Sound familiar?</p><p>Data quality issues don’t announce themselves. They creep in silently — a schema change upstream, a failed validation in a microservice, a vendor API returning empty fields. By the time someone notices, the damage is done: wrong decisions made, trust eroded, hours spent firefighting.</p><p>Having built and led data platforms across diverse environments, I’ve learned one truth: <strong>you cannot manage what you do not measure</strong>. And most teams don’t measure data quality until it’s too late.</p><p>Snowflake’s <strong>Data Quality Monitoring</strong> feature, powered by Data Metric Functions (DMFs), changes this equation. Let me walk you through how it works and how to implement it effectively.</p><p><strong>What Are Data Metric Functions?</strong></p><p>A Data Metric Function (DMF) is a specialized UDF that measures a specific quality attribute of your data. Think of it as a health check that runs continuously on your tables.</p><p>Unlike traditional approaches where you bolt on a third-party tool or write fragile dbt tests that only run during transformation, DMFs are <strong>native to Snowflake</strong> and operate directly on your tables with:</p><ul><li><strong>Schedule-based execution</strong> — run every N minutes</li><li><strong>Trigger-based execution</strong> — run only when data changes</li><li><strong>Centralized results</strong> — all metrics stored in a single event table</li><li><strong>OpenTelemetry format</strong> — easy integration with observability stacks</li></ul><p>Snowflake provides system DMFs out of the box, and you can create custom ones for domain-specific checks.</p><p><strong>System DMFs: Your Starting Point</strong></p><p>Snowflake ships these built-in DMFs in SNOWFLAKE.CORE:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*_XlHbj4fbfMz-2Rsg9HvAg.png" /></figure><p>These cover the most common quality dimensions: <strong>completeness</strong>, <strong>uniqueness</strong>, <strong>volume</strong>, and <strong>timeliness</strong>.</p><p><strong>Implementation: A Step-by-Step Walkthrough</strong></p><p>Let me demonstrate with a realistic scenario. Suppose you have a customers table that feeds multiple downstream systems:</p><pre>CREATE TABLE analytics.core.customers (<br>    customer_id INT,<br>    first_name STRING,<br>    last_name STRING,<br>    email STRING,<br>    phone STRING,<br>    city STRING,<br>    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP()<br>);</pre><p><strong>Step 1: Set the Monitoring Schedule</strong></p><p>Before attaching DMFs, define how often you want checks to run:</p><pre>-- Check every 5 minutes (good for critical tables)<br>ALTER TABLE analytics.core.customers<br>  SET DATA_METRIC_SCHEDULE = &#39;5 MINUTE&#39;;</pre><pre>-- Only check when data actually changes<br>ALTER TABLE analytics.core.customers<br>  SET DATA_METRIC_SCHEDULE = &#39;TRIGGER_ON_CHANGES&#39;;</pre><p><strong>Step 2: Attach System DMFs</strong></p><pre>-- Monitor for NULLs in critical columns<br>ALTER TABLE analytics.core.customers<br>  ADD DATA METRIC FUNCTION SNOWFLAKE.CORE.NULL_COUNT ON (email);<br><br>ALTER TABLE analytics.core.customers<br>  ADD DATA METRIC FUNCTION SNOWFLAKE.CORE.NULL_COUNT ON (first_name);<br><br>-- Monitor row count (catch unexpected drops or spikes)<br>ALTER TABLE analytics.core.customers<br>  ADD DATA METRIC FUNCTION SNOWFLAKE.CORE.ROW_COUNT ON ();<br><br>-- Monitor duplicates on the primary key<br>ALTER TABLE analytics.core.customers<br>  ADD DATA METRIC FUNCTION SNOWFLAKE.CORE.DUPLICATE_COUNT ON (customer_id);<br><br>-- Monitor freshness<br>ALTER TABLE analytics.core.customers<br>  ADD DATA METRIC FUNCTION SNOWFLAKE.CORE.FRESHNESS ON (created_at);</pre><p>That’s it. Five statements and your table is now continuously monitored across four quality dimensions.</p><p><strong>Step 3: Query Results</strong></p><p>Results are stored in SNOWFLAKE.LOCAL.DATA_QUALITY_MONITORING_RESULTS:</p><pre>SELECT<br>    TABLE_NAME,<br>    METRIC_NAME,<br>    ARGUMENT_NAMES,<br>    VALUE,<br>    MEASUREMENT_TIME<br>FROM SNOWFLAKE.LOCAL.DATA_QUALITY_MONITORING_RESULTS<br>WHERE TABLE_DATABASE = &#39;ANALYTICS&#39;<br>  AND TABLE_SCHEMA = &#39;CORE&#39;<br>ORDER BY MEASUREMENT_TIME DESC;</pre><p><strong>Custom DMFs: Where It Gets Powerful</strong></p><p>System DMFs handle generic checks. But real data quality is domain-specific. Here’s where custom DMFs shine.</p><p><strong>Example 1: Validate Email Format</strong></p><pre>CREATE OR REPLACE DATA METRIC FUNCTION analytics.core.invalid_email_count(<br>    ARG_T TABLE(ARG_C STRING)<br>)<br>RETURNS NUMBER<br>AS<br>$$<br>    SELECT COUNT(*)<br>    FROM ARG_T<br>    WHERE ARG_C IS NOT NULL<br>      AND ARG_C NOT RLIKE &#39;^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$&#39;<br>$$;<br><br>-- Attach it<br>ALTER TABLE analytics.core.customers<br>  ADD DATA METRIC FUNCTION analytics.core.invalid_email_count ON (email);</pre><p><strong>Example 2: Detect Negative Values Where They Shouldn’t Exist</strong></p><pre>CREATE OR REPLACE DATA METRIC FUNCTION analytics.core.negative_amount_count(<br>    ARG_T TABLE(ARG_C DECIMAL(10,2))<br>)<br>RETURNS NUMBER<br>AS<br>$$<br>    SELECT COUNT(*) FROM ARG_T WHERE ARG_C &lt; 0<br>$$;<br><br>ALTER TABLE analytics.core.orders<br>  ADD DATA METRIC FUNCTION analytics.core.negative_amount_count ON (order_amount);</pre><p><strong>Example 3: Referential Integrity (Orphan Records)</strong></p><pre>CREATE OR REPLACE DATA METRIC FUNCTION analytics.core.orphan_customer_count(<br>    ARG_T TABLE(ARG_C INT)<br>)<br>RETURNS NUMBER<br>AS<br>$$<br>    SELECT COUNT(*)<br>    FROM ARG_T<br>    WHERE ARG_C NOT IN (<br>        SELECT customer_id FROM analytics.core.customers<br>    )<br>$$;<br><br>ALTER TABLE analytics.core.orders<br>  ADD DATA METRIC FUNCTION analytics.core.orphan_customer_count ON (customer_id);</pre><p>This one is a game-changer. Referential integrity violations are one of the most common and hardest-to-catch quality issues in warehouses that don’t enforce foreign keys.</p><p><strong>Anomaly Detection: Let Snowflake Find the Unknowns</strong></p><p>Sometimes you don’t know what “bad” looks like. You can’t set a threshold for row count if your table grows organically. This is where anomaly detection comes in.</p><pre>ALTER TABLE analytics.core.customers<br>  ADD DATA METRIC FUNCTION SNOWFLAKE.CORE.ROW_COUNT ON ()<br>    ANOMALY_DETECTION = TRUE;</pre><p>Snowflake trains an algorithm on historical DMF results (minimum 2 weeks for frequently-run DMFs) and automatically flags values outside the predicted range. You can tune sensitivity:</p><pre>-- Too many false positives? Lower sensitivity<br>ALTER TABLE analytics.core.customers<br>  MODIFY DATA METRIC FUNCTION SNOWFLAKE.CORE.ROW_COUNT ON ()<br>    SET SENSITIVITY = &#39;LOW&#39;;<br><br>-- Missing real issues? Increase it<br>ALTER TABLE analytics.core.customers<br>  MODIFY DATA METRIC FUNCTION SNOWFLAKE.CORE.ROW_COUNT ON ()<br>    SET SENSITIVITY = &#39;HIGH&#39;;</pre><p><strong>Schema-Level Monitoring: Scale Without Repetition</strong></p><p>If you have 50 tables in a schema, you don’t want to write 200 ALTER statements. Apply DMFs at the schema level:</p><pre>ALTER SCHEMA analytics.core<br>  ADD DATA METRIC FUNCTION SNOWFLAKE.CORE.NULL_COUNT<br>    FOR ALL COLUMNS;</pre><p>One statement. Every column in every table in that schema now has NULL monitoring. This is how you scale data quality governance across an organization.</p><p><strong>Architecture Recommendations</strong></p><p>After implementing this across multiple organizations, here’s my recommended approach:<br><strong>Tier Your Tables<br></strong>Not every table deserves 5-minute monitoring. I use three tiers:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*ItFF1ufTX1Nhks9MbJLD9w.png" /></figure><p><strong>Start with Five Core Checks</strong></p><p>For every production table, attach at minimum:</p><ol><li><strong>ROW_COUNT</strong> — catches truncations and load failures</li><li><strong>FRESHNESS</strong> — catches stale data from broken pipelines</li><li><strong>NULL_COUNT on PK columns</strong> — catches upstream schema issues</li><li><strong>DUPLICATE_COUNT on PK columns</strong> — catches deduplication failures</li><li><strong>One domain-specific custom DMF</strong> — catches business logic violations</li></ol><p><strong>Build a Response Workflow<br></strong>Metrics without action are just numbers. Pair DMFs with Snowflake Alerts:</p><pre>CREATE ALERT analytics.core.stale_customers_alert<br>    WAREHOUSE = COMPUTE_WH<br>    SCHEDULE = &#39;10 MINUTE&#39;<br>    IF (EXISTS (<br>        SELECT 1<br>        FROM SNOWFLAKE.LOCAL.DATA_QUALITY_MONITORING_RESULTS<br>        WHERE TABLE_NAME = &#39;CUSTOMERS&#39;<br>          AND METRIC_NAME = &#39;FRESHNESS&#39;<br>          AND VALUE &gt; 3600  -- stale for more than 1 hour<br>          AND MEASUREMENT_TIME &gt; DATEADD(&#39;MINUTE&#39;, -15, CURRENT_TIMESTAMP())<br>    ))<br>    THEN<br>        CALL SYSTEM$SEND_EMAIL(<br>            &#39;email_integration&#39;,<br>            &#39;data-oncall@company.com&#39;,<br>            &#39;ALERT: Customers table is stale&#39;,<br>            &#39;No updates in over 1 hour. Check pipeline.&#39;<br>        );</pre><p><strong>What This Replaces</strong></p><p>Before DMFs, teams typically relied on:</p><ul><li><strong>dbt tests</strong> — only run during transformation, not continuously</li><li><strong>Great Expectations</strong> — requires separate infrastructure</li><li><strong>Custom scripts</strong> — fragile, hard to maintain, no central visibility</li><li><strong>Manual spot checks</strong> — doesn’t scale</li></ul><p>DMFs don’t eliminate the need for transformation-time tests (keep your dbt tests). But they add a <strong>continuous monitoring layer</strong> that catches issues between pipeline runs, after ad-hoc loads, and during periods when your orchestrator isn’t running.</p><p><strong>Limitations to Know<br></strong>Being transparent about current limitations (as of the preview):</p><ol><li><strong>Enterprise Edition required</strong> — not available on Standard</li><li><strong>Compute cost</strong> — DMFs use warehouse compute; schedule thoughtfully</li><li><strong>Minimum 5-minute schedule</strong> — you can’t go sub-minute</li><li><strong>Anomaly detection training</strong> — needs 2 weeks of history minimum</li><li><strong>No built-in notification</strong> — you need to pair with Alerts or external tools</li></ol><p>Data quality isn’t a project. It’s a discipline. The teams that build trust with their stakeholders aren’t the ones with the fanciest dashboards — they’re the ones who catch problems before anyone else notices.</p><p>Snowflake’s DMFs give you a native, scalable, low-maintenance way to build that discipline directly into your platform. No additional tools to manage. No separate infrastructure to maintain. Just SQL.</p><p>Start with your five most critical tables. Attach the core system DMFs. Add one custom check per table. Set up alerts. You’ll have production-grade data quality monitoring running within an hour.</p><p>Your Monday mornings will thank you.</p><p><em>Prerequisites: Snowflake Enterprise Edition or higher. Feature is currently in Preview and available to all Enterprise accounts.</em></p><p><strong>If you found this useful, follow me for more practical data engineering content. I write about building reliable data platforms without the hype.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d064e0a95931" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering PII Data Masking in Snowflake: A Complete Guide]]></title>
            <link>https://medium.com/@sujityadav99/mastering-pii-data-masking-in-snowflake-a-complete-guide-fa8e9494e869?source=rss-728631a1cdcb------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa8e9494e869</guid>
            <category><![CDATA[data-privacy-protection]]></category>
            <category><![CDATA[snowflake-data-cloud]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-security]]></category>
            <category><![CDATA[data-governance]]></category>
            <dc:creator><![CDATA[Sujit Yadav]]></dc:creator>
            <pubDate>Fri, 13 Feb 2026 06:53:37 GMT</pubDate>
            <atom:updated>2026-02-13T06:53:37.471Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Protecting sensitive data without sacrificing usability</em></p><p><strong>Introduction</strong></p><p>With regulations like GDPR, CCPA, and India’s DPDP Act tightening, protecting personally identifiable information (PII) has become non-negotiable. Data breaches don’t just result in hefty fines — they erode customer trust.</p><p>Snowflake offers multiple approaches to mask sensitive data dynamically. In this guide, we’ll explore these methods — from simple masking policies to sophisticated automated tag-based solutions — helping you choose the right approach for your organization.</p><p><strong>What is Dynamic Data Masking?</strong></p><p><strong>Dynamic Data Masking (DDM)</strong> hides sensitive data at query time based on user roles, without altering the underlying data. An analyst might see ****@gmail.com while an admin sees the actual email — all from the same query.</p><p>This approach offers several advantages:</p><ul><li><strong>No data duplication</strong> — One dataset serves all users</li><li><strong>Real-time enforcement</strong> — Masking applies instantly as roles change</li></ul><p><strong>Audit-friendly</strong> — Original data remains intact for compliance</p><h3>Approach 1: Direct Masking Policies</h3><p>The simplest approach — create policies and apply them directly to columns.</p><p>Create and Apply a Masking Policy</p><pre>-- Create masking policy for emails<br>CREATE OR REPLACE MASKING POLICY mask_email AS (val STRING) <br>RETURNS STRING -&gt;<br>    CASE <br>        WHEN CURRENT_ROLE() IN (&#39;DATA_ADMIN&#39;) THEN val<br>        ELSE REGEXP_REPLACE(val, &#39;.+\@&#39;, &#39;****@&#39;)<br>    END;<br><br>-- Apply to column<br>ALTER TABLE customers <br>MODIFY COLUMN email SET MASKING POLICY mask_email;</pre><h3>Common Masking Patterns</h3><pre>-- Phone: Show last 4 digits<br>CONCAT(&#39;XXX-XXX-&#39;, RIGHT(val, 4))<br><br>-- PAN/Tax ID: Partial masking<br>CONCAT(LEFT(val, 2), &#39;****&#39;, RIGHT(val, 1))<br><br>-- Date of Birth: Show only year<br>DATE_FROM_PARTS(YEAR(val), 1, 1)<br><br>-- Name: First initial only<br>CONCAT(LEFT(val, 1), &#39;***&#39;)</pre><p>Pros: Simple, fine-grained control<br>Cons: Manual effort per column, doesn’t scale well</p><h3>Approach 2: Tag-Based Masking (Recommended)</h3><p>This is the enterprise-grade solution — combining Snowflake’s object tagging with masking policies for automated, centralized PII protection.</p><p>How It Works</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*NkOPmbq8h6d2QNkZ7-Xwqw.png" /></figure><p>The magic: Once a tag is linked to a masking policy, any column with that tag is automatically masked.</p><p>Step 1: Create Tags and Policies</p><pre>-- Create PII tags<br>CREATE TAG governance.PII_EMAIL;<br>CREATE TAG governance.PII_PHONE;<br>CREATE TAG governance.PII_PAN;<br><br>-- Create corresponding masking policies<br>CREATE MASKING POLICY governance.mask_email AS (val STRING) <br>RETURNS STRING -&gt;<br>    CASE <br>        WHEN CURRENT_ROLE() IN (&#39;DATA_ADMIN&#39;) THEN val<br>        ELSE CONCAT(LEFT(val, 2), &#39;****@&#39;, SPLIT_PART(val, &#39;@&#39;, 2))<br>    END;<br><br>-- Link policy to tag<br>ALTER TAG governance.PII_EMAIL <br>SET MASKING POLICY governance.mask_email;</pre><p>Step 2: Configuration Table</p><pre>CREATE TABLE governance.mask_config (<br>    db_name VARCHAR,<br>    schema_name VARCHAR,<br>    table_name VARCHAR,<br>    column_name VARCHAR,<br>    tag_name VARCHAR,<br>    active_indicator BOOLEAN DEFAULT TRUE<br>);</pre><p>Step 3: Automated PII Detection</p><p>The scanning procedure:</p><ol><li>Scans column names using regex patterns (e.g., .*email.*, .*phone.*)</li><li>Samples data values and validates against PII patterns</li><li>Applies threshold (e.g., 30% match rate) to reduce false positives</li><li>Stores results for review and tagging</li></ol><pre>-- Pattern matching examples<br>column_patterns = {<br>    &#39;EMAIL&#39;: r&#39;.*email.*|.*mail.*&#39;,<br>    &#39;PAN&#39;: r&#39;.*pan.*|.*tax.*id.*&#39;,<br>    &#39;PHONE&#39;: r&#39;.*phone.*|.*mobile.*&#39;,<br>    &#39;DOB&#39;: r&#39;.*dob.*|.*birth.*date.*&#39;<br>}<br><br>-- Data validation patterns<br>data_patterns = {<br>    &#39;EMAIL&#39;: r&#39;^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$&#39;,<br>    &#39;PAN&#39;: r&#39;^[A-Z]{5}[0-9]{4}[A-Z]$&#39;,<br>    &#39;PHONE&#39;: r&#39;^[6-9][0-9]{9}$&#39;<br>}</pre><p>Step 4: Apply Tags</p><pre>-- Simple tag application<br>ALTER TABLE customers <br>MODIFY COLUMN email <br>SET TAG governance.PII_EMAIL = &#39;TRUE&#39;;<br><br>-- Masking now applies automatically!</pre><p>Step 5: Schedule Automation</p><pre>-- Daily automated pipeline<br>CREATE TASK task_pii_scan<br>    SCHEDULE = &#39;USING CRON 0 6 * * * UTC&#39;<br>    WAREHOUSE = compute_wh<br>AS CALL governance.scan_for_pii(&#39;MY_DATABASE&#39;);<br><br>CREATE TASK task_apply_tags<br>    AFTER task_pii_scan<br>AS CALL governance.apply_pii_tags();</pre><h4>The Power of Active Indicator</h4><p>One killer feature: disable masking without removing policies.</p><pre>-- To stop masking a column, just flip the flag<br>UPDATE governance.mask_config<br>SET active_indicator = FALSE<br>WHERE column_name = &#39;email&#39;;<br><br>-- Then unset the tag<br>ALTER TABLE customers <br>MODIFY COLUMN email UNSET TAG governance.PII_EMAIL;</pre><p>This provides flexibility for exceptions while maintaining centralized control.</p><h3>Approach 3: Row Access Policies</h3><p>When you need to control which rows users see, not just mask values:</p><pre>CREATE ROW ACCESS POLICY region_policy<br>AS (region VARCHAR) RETURNS BOOLEAN -&gt;<br>    CASE<br>        WHEN CURRENT_ROLE() = &#39;DATA_ADMIN&#39; THEN TRUE<br>        WHEN CURRENT_ROLE() = &#39;NORTH_ANALYST&#39; AND region = &#39;NORTH&#39; THEN TRUE<br>        ELSE FALSE<br>    END;<br><br>ALTER TABLE sales ADD ROW ACCESS POLICY region_policy ON (region);</pre><p>Use case: Regional data segregation, customer data isolation</p><h3>Approach 4: Secure Views</h3><p>For simpler scenarios without policy overhead:</p><pre>CREATE SECURE VIEW v_customers_masked AS<br>SELECT <br>    customer_id,<br>    CASE WHEN CURRENT_ROLE() = &#39;ADMIN&#39; THEN email<br>         ELSE REGEXP_REPLACE(email, &#39;.+\@&#39;, &#39;****@&#39;)<br>    END AS email<br>FROM customers;</pre><p>Pros: Simple, no policy management<br>Cons: Users must query the view, not the table</p><h4>Quick Comparison</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*FqY5GcZvk9kQN42qGiA_Fg.png" /></figure><p>Recommendation:</p><ul><li>Small datasets: Direct policies or secure views</li><li>Enterprise scale: Tag-based masking</li><li>Row restrictions: Row access policies</li><li>Hybrid: Combine tag-based + row access for complete coverage</li></ul><h3>Best Practices</h3><p>1. Centralize Everything</p><p>Keep all governance objects in a dedicated schema:</p><pre>CREATE SCHEMA governance.data_protection;</pre><p>2. Use Meaningful Names</p><pre>-- Good<br>PII_EMAIL, PII_PHONE, PII_PAN<br><br>-- Bad  <br>TAG1, MASK_A, t_email</pre><p>3. Validate Before Tagging</p><p>Always sample data and apply match thresholds (e.g., 30%) to reduce false positives.</p><p>4. Monitor and Audit</p><pre>-- Track all tagged columns<br>SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.TAG_REFERENCES<br>WHERE TAG_NAME LIKE &#39;PII%&#39;;</pre><p>5. Test with Multiple Roles</p><pre>USE ROLE analyst_role;<br>SELECT email FROM customers LIMIT 5;  -- Masked<br><br>USE ROLE data_admin;<br>SELECT email FROM customers LIMIT 5;  -- Visible</pre><h3>Conclusion</h3><p>Snowflake provides flexible, powerful options for PII masking. For organizations managing large, evolving data estates, tag-based masking with automated PII detection delivers the best balance of security, scalability, and maintainability.</p><p>Key takeaways:</p><ol><li>Start with tags — Centralized control that scales</li><li>Automate discovery — Manual identification doesn’t work at scale</li><li>Use validation thresholds — Reduce false positives</li><li>Enable/disable via config — Flexibility without policy changes</li><li>Schedule regular scans — New columns appear constantly</li></ol><p>By implementing a robust masking strategy, you achieve compliance while demonstrating commitment to data privacy — building the trust that today’s customers demand.</p><p><em>What masking approach works best for your organization? Share your experience in the comments!</em></p><p>#Snowflake #DataSecurity #PII #DataMasking #DataGovernance #Privacy</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa8e9494e869" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>