You Don’t Need a Ticket to Govern Your Data Anymore: Cortex Code Data Governance Skills
From the publisher’s feed, collected in the ZeroLabs newsroom.
Natural language governance is here — and it’s about to make your data stewards very happy.Raise your hand if this sounds familiar.A compliance officer needs an access audit. She files a ticket. A data engineer picks it up three days later, crafts a query against ACCOUNT_USAGE, exports a CSV, and hands it back. By the time she reads it, half the data is stale — and she's already been asked for a follow-up.Now multiply that across sensitive data classification, masking policy creation, data quality monitoring, and lineage analysis. All of it bottlenecked behind SQL expertise and engineering bandwidth. All of it slower than it needs to be.That’s the governance gap. And it exists not because teams don’t care about governance, but because the tooling has always demanded specialization most data roles don’t have.Snowflake’s Cortex Code Data Governance Skills change that equation. Instead of writing DDL for masking policies or memorizing ACCOUNT_USAGE schema, you describe what you need in plain English. Cortex Code selects the right governance skill, runs verified query patterns against your live account metadata, and returns structured, actionable results — no ticket required.This article covers how the Data Governance Skills work, what each domain unlocks, and how to move an organization from governance debt to a measurable, improving posture — one conversation at a time.Why Native Governance Is Architecturally DifferentMost organizations manage governance metadata outside the data platform — in external catalogs, spreadsheets, or third-party tools. That creates an inevitable lag: the catalog is always catching up to what’s actually in Snowflake. Classification profiles go stale. Masking policies get applied inconsistently. Audit trails become archaeology projects.Snowflake Horizon Catalog keeps governance metadata native — living inside the same platform as the data itself. Classification tags, masking policies, quality metrics, and lineage relationships are always current, always queryable, and always enforceable at query time.Cortex Code Data Governance Skills sit on top of that foundation. They expose curated, tested query patterns across five governance domains, wrapped in a natural language interface that any data role can use — not just the engineers who know the ACCOUNT_USAGE schema from memory.“Verified” here means something specific: these aren’t ad-hoc queries improvised at runtime. They’re patterns developed and tested against real governance use cases — using correct functions, avoiding known performance pitfalls, and returning structured output rather than raw rows. The difference matters when you’re writing masking policies that will run at query time on production tables.The Five Governance Skill Domains1. Sensitive Data ClassificationDiscover PII, PHI, and PCI data across tables, schemas, or entire databases using Snowflake’s built-in sensitive data categories — identifiers, quasi-identifiers, and sensitive attributes. Create automated classification profiles with auto-tagging so new data gets classified as it lands, not weeks later when someone notices a gap.Prompts that work:"Scan my ANALYTICS database for PII""What sensitive data exists in SALES.NA.ORDERS?""Create a classification profile for PROD_DB with auto-tagging enabled""Create a custom classifier for employee IDs matching EMP-XXXXX""Which tables haven't been classified in the last 90 days?"Manual classification is always incomplete. At scale, it’s impossible. The last prompt is the one most teams skip — staleness detection. Knowing what you’ve classified is less useful than knowing when that knowledge is going out of date.Note: Automated classification profiles are generally available. Custom classifier creation may have regional or tier-based availability — check the current Snowflake documentation before building this into production workflows.2. Data Protection PoliciesGenerate masking policies, row access policies, projection policies, and aggregation policies using best-practice patterns — with compliance templates for HIPAA, PCI-DSS, GDPR, CCPA, SOX, and FERPA built in.Prompts that work:"Create masking policies for all PII columns found in ANALYTICS""Apply HIPAA protection templates to the PATIENT_DATA schema""Build a row access policy that restricts EMEA data to EMEA roles""Audit my existing masking policies for anti-patterns"That last prompt is worth emphasizing. Most hand-written masking policies use CURRENT_ROLE() instead of IS_ROLE_IN_SESSION(). That's a subtle but critical difference: CURRENT_ROLE() checks only your active role, not your full role hierarchy. If a user has the authorized role in their session but it isn't their primary role, CURRENT_ROLE() denies access incorrectly. Cortex Code generates policies using IS_ROLE_IN_SESSION() by default — the right function, with memoizable patterns to minimize policy evaluation overhead at query time.The full set of best-practice patterns built into the generated policies:IS_ROLE_IN_SESSION() over CURRENT_ROLE() — full role hierarchy checkMemoizable functions to reduce per-row evaluation costAttribute-based access control (ABAC) for dynamic, scalable policiesConsolidated, reusable policies rather than one-per-column sprawl3. Data Quality MonitoringCortex Code’s quality skill analyzes your Data Metric Function (DMF) results to produce schema-level health scores, root-cause analysis for quality failures, regression detection, and trend tracking over time — with anomaly detection and automated alerting via email or webhook.Prompts that work:"What's the data quality health score for my FINANCE schema?""Set up an alert if data quality drops below 90%""What caused the quality regression in SALES.ORDERS last week?""Show me quality trends for CUSTOMER_DATA over the last 30 days"The health score is a composite metric derived from your DMF results — null rates, uniqueness violations, referential integrity failures, freshness gaps. It’s not a single query result; it’s an aggregated view across all metric types configured for a schema. If you haven’t set up DMFs yet, start there — the quality skill is only as useful as the metrics feeding it.Most quality monitoring is reactive. You find out about a problem when a downstream dashboard breaks or an analyst files a ticket. Proactive alerting with a defined threshold means you catch regressions before they propagate — and you have an automated record of when quality dipped and by how much, which matters when you’re explaining a data incident after the fact.4. Data Lineage AnalysisChange impact analysis with severity scoring (CRITICAL / MODERATE / LOW), upstream source tracing, trust scoring per dataset, column-level dependency mapping, and usage frequency analysis showing how many users and workloads depend on a given table.Prompts that work:"What will break if I change the schema of RAW_DB.SALES.ORDERS?""Where does the data in ANALYTICS.REVENUE_SUMMARY come from?""What's the trust score for CUSTOMER_MASTER?""Show me all column-level dependencies for ORDER_ID"The trust score is a composite derived from lineage depth, data freshness, quality metric history, and access patterns. A table with recent quality failures, infrequent refreshes, and long lineage chains from external sources will score lower than a curated, frequently refreshed, well-monitored table. It’s not a hard pass/fail — it’s signal for analysts deciding which tables to trust for high-stakes reporting.The impact analysis use case is the one data engineers will use every sprint. Before any schema change, you can get a risk-scored list of downstream objects — views, dashboards, pipelines — sorted by severity. That’s the difference between a planned migration and an unplanned production incident discovered by a BI team at 9am.5. Access Audit and General GovernanceWho accessed what, when, and how. Role hierarchy analysis, DDL change tracking, privilege escalation detection, and compliance posture checks — all queryable in natural language against ACCOUNT_USAGE.Prompts that work:"Who accessed CUSTOMER_PII in the last 30 days?""Show me all DDL changes to production tables this month""Which roles have privilege escalation paths to ACCOUNTADMIN?""Generate a GDPR data access report for the last quarter"This is the ticket-elimination use case the compliance officer in the opening scenario needed. These audits are self-service, on-demand, and always current — not three days stale. The engineering time recovered per compliance cycle compounds quickly once this becomes the default workflow.The privilege escalation query deserves its own callout. Most Snowflake accounts accumulate role hierarchies organically over time, and escalation paths to ACCOUNTADMIN through indirect grants are easy to miss. Running this quarterly as a governance hygiene check is worth building into your compliance calendar.The Governance Maturity ScoreEvery governance initiative needs a baseline — a number you can bring to leadership to quantify the current state and justify investment in closing the gaps.Ask: "What is my governance maturity score?" and the governance skill generates an assessment across three pillars:Pillar What It Measures Classification Coverage, recency, and completeness of sensitive data tagging Protection Masking policy coverage across classified sensitive columns Monitoring Active DMF coverage, alerting configuration, and audit trail completenessEach pillar is scored based on three sub-dimensions: coverage (what percentage of in-scope objects are addressed), staleness (when were profiles and policies last updated), and completeness (are policies applied to all sensitive columns, or just some).The output format varies by account state — an account with no DMFs configured will return a different structure than one with partial coverage. Treat the score as a directional baseline, not a precise metric. What matters is the delta: run it before a governance initiative, run it after, and report the improvement.The Assess-to-Remediate WorkflowThe full governance cycle — baseline, classify, protect, monitor, measure — fits in a single Cortex Code session.Step 1 — Establish your baseline"What is my governance maturity score?"You get a per-database breakdown, gap analysis, and a prioritized remediation roadmap showing which domains need the most attention.Step 2 — Close the classification gap"Scan my ANALYTICS database for PII""Create a classification profile for PROD_DB with auto-tagging enabled""Which tables haven't been classified in the last 90 days?"Classify unscanned databases, create continuous profiles, and fill gaps for domain-specific patterns the built-in classifiers don’t cover.Step 3 — Close the protection gap"Create masking policies for all PII columns found in ANALYTICS""Apply HIPAA templates to the PATIENT_DATA schema""Audit my existing masking policies for anti-patterns"Move from classified to protected, using compliance-specific templates and best-practice patterns — not hand-rolled policies that introduce subtle bugs.Step 4 — Close the monitoring gap"Set up continuous quality monitoring for my top 5 production schemas""Set up an alert if quality drops below 90%"Implement proactive monitoring with automated alerting, and create the audit trail needed for compliance reporting.Step 5 — Measure and report"What is my governance maturity score now?"Compare before and after. Quantify the improvement. That’s your governance report for leadership — numbers, not narratives.Who Benefits and HowThe same skills serve different needs across every data role.Data Engineers run lineage impact analysis before every schema change. They know what breaks before they push — and stop discovering downstream dependencies in production incident retrospectives.Data Stewards go from raw classification results to applied masking policies in one conversation. They audit existing policies for anti-patterns without needing to remember ACCOUNT_USAGE schema by heart.Compliance Officers run GDPR data access reports, privilege escalation checks, and DDL audit trails on demand. No ticket, no waiting, no data that aged three days in the queue.Data Analysts check quality health scores and trust ratings before building reports. They stop building dashboards on top of datasets that are silently failing quality checks.Snowflake Admins run the initial maturity assessment, establish account-wide baselines, and set up the role privileges that allow every team to self-serve governance within defined guardrails. The Skills handle query construction; admins handle access control.PrerequisitesTo use Data Governance Skills in Cortex Code, your session role needs:Access to ACCOUNT_USAGE views for audit, lineage, and usage queriesOBJECT_VIEWER and USAGE_VIEWER database roles on the SNOWFLAKE databaseGOVERNANCE_VIEWER and SECURITY_VIEWER database roles on the SNOWFLAKE databaseAppropriate object-level privileges on target schemas for classification and policy creationThe admin team sets this up once and grants access to the roles that need it. If you’re seeing permission errors on specific skills, check these roles first — the Skills handle query construction, but they can’t work around missing underlying access.What’s NextAutomate the maturity score. The Cortex Code maturity prompt gives you a point-in-time snapshot. To make that snapshot useful over time — for quarterly business reviews, audit evidence, and governance improvement tracking — you need to persist it. Here’s a production-grade implementation: a stored procedure that computes scores directly from ACCOUNT_USAGE, a history table to capture each run, and a monthly Task that drives it automatically.Step 1 — Create the tracking schema and history tableCREATE DATABASE IF NOT EXISTS GOVERNANCE;CREATE SCHEMA IF NOT EXISTS GOVERNANCE.MONITOR;CREATE TABLE IF NOT EXISTS GOVERNANCE.MONITOR.MATURITY_HISTORY ( snapshot_date DATE, classification_score FLOAT, protection_score FLOAT, monitoring_score FLOAT, overall_score FLOAT, score_json VARIANT, details VARIANT);Step 2 — Create the scoring stored procedureThe procedure computes three pillar scores against live ACCOUNT_USAGE metadata and inserts a row into the history table on each run. Each score is normalized to a 0–5 scale.CREATE OR REPLACE PROCEDURE GOVERNANCE.MONITOR.COMPUTE_MATURITY_SCORE()RETURNS VARIANTLANGUAGE SQLEXECUTE AS OWNERAS$$DECLARE total_databases FLOAT DEFAULT 0; classified_databases FLOAT DEFAULT 0; classification_score FLOAT DEFAULT 0; total_sensitive_columns FLOAT DEFAULT 0; masked_sensitive_columns FLOAT DEFAULT 0; protection_score FLOAT DEFAULT 0; tables_with_policies FLOAT DEFAULT 0; total_tables FLOAT DEFAULT 0; monitoring_score FLOAT DEFAULT 0; overall_score FLOAT DEFAULT 0; result VARIANT;BEGIN -- Classification pillar: % of databases with classification profiles SELECT COUNT(DISTINCT database_name) INTO :total_databases FROM SNOWFLAKE.ACCOUNT_USAGE.DATABASES WHERE deleted IS NULL;SELECT COUNT(DISTINCT database_name) INTO :classified_databases FROM SNOWFLAKE.ACCOUNT_USAGE.DATA_CLASSIFICATION_LATEST; IF (total_databases > 0) THEN classification_score := LEAST((:classified_databases / :total_databases) * 5, 5); ELSE classification_score := 0; END IF; -- Protection pillar: % of classified tables with masking policies applied SELECT COUNT(DISTINCT table_name) INTO :total_sensitive_columns FROM SNOWFLAKE.ACCOUNT_USAGE.DATA_CLASSIFICATION_LATEST; SELECT COUNT(DISTINCT ref_entity_name) INTO :masked_sensitive_columns FROM SNOWFLAKE.ACCOUNT_USAGE.POLICY_REFERENCES WHERE policy_kind = 'MASKING_POLICY'; IF (total_sensitive_columns > 0) THEN protection_score := LEAST((:masked_sensitive_columns / :total_sensitive_columns) * 5, 5); ELSE IF (masked_sensitive_columns > 0) THEN protection_score := 2.5; -- Policies exist but no classification baseline ELSE protection_score := 0; END IF; END IF; -- Monitoring pillar: % of base tables covered by any policy or DMF SELECT COUNT(DISTINCT table_name) INTO :total_tables FROM SNOWFLAKE.ACCOUNT_USAGE.TABLES WHERE deleted IS NULL AND table_type = 'BASE TABLE'; SELECT COUNT(DISTINCT ref_entity_name) INTO :tables_with_policies FROM SNOWFLAKE.ACCOUNT_USAGE.POLICY_REFERENCES WHERE policy_kind IN ('ROW_ACCESS_POLICY', 'MASKING_POLICY', 'DATA_METRIC_FUNCTION'); IF (total_tables > 0) THEN monitoring_score := LEAST((:tables_with_policies / :total_tables) * 5, 5); ELSE monitoring_score := 0; END IF; overall_score := ROUND((:classification_score + :protection_score + :monitoring_score) / 3, 2); result := OBJECT_CONSTRUCT( 'classification_score', ROUND(:classification_score, 2), 'protection_score', ROUND(:protection_score, 2), 'monitoring_score', ROUND(:monitoring_score, 2), 'overall_score', :overall_score, 'assessed_at', CURRENT_TIMESTAMP(), 'total_databases', :total_databases, 'classified_databases', :classified_databases, 'total_sensitive_columns', :total_sensitive_columns, 'masked_sensitive_columns', :masked_sensitive_columns, 'total_tables', :total_tables, 'tables_with_policies', :tables_with_policies ); INSERT INTO GOVERNANCE.MONITOR.MATURITY_HISTORY (snapshot_date, classification_score, protection_score, monitoring_score, overall_score, score_json, details) SELECT CURRENT_DATE(), :classification_score, :protection_score, :monitoring_score, :overall_score, :result, :result; RETURN result;END;$$;Step 3 — Schedule the monthly Task and capture your first baseline-- Run on the 1st of every month at 6AM PTCREATE OR REPLACE TASK GOVERNANCE.MONITOR.MONTHLY_MATURITY_ASSESSMENT SCHEDULE = 'USING CRON 0 6 1 * * America/Los_Angeles' COMMENT = 'Monthly governance maturity score snapshot'AS CALL GOVERNANCE.MONITOR.COMPUTE_MATURITY_SCORE();ALTER TASK GOVERNANCE.MONITOR.MONTHLY_MATURITY_ASSESSMENT RESUME;-- Run manually now to establish your first baselineCALL GOVERNANCE.MONITOR.COMPUTE_MATURITY_SCORE();-- Query the history to track improvement over timeSELECT * FROM GOVERNANCE.MONITOR.MATURITY_HISTORY ORDER BY snapshot_date DESC;A few design decisions worth noting. The procedure uses EXECUTE AS OWNER so it can query ACCOUNT_USAGE without requiring callers to have direct access — the owning role needs GOVERNANCE_VIEWER and SECURITY_VIEWER on the SNOWFLAKE database. The protection score handles the edge case where masking policies exist but no classification baseline does, assigning a partial score of 2.5 rather than zero — policies without classification context are better than nothing, but you can't calculate true coverage without the denominator. And the overall score is a simple average of the three pillars, which you can weight differently if your organization's governance priorities differ.Over time, this table becomes your governance improvement curve. Plotting overall_score by snapshot_date is the chart you bring to leadership when you need to show that the governance investment is working.Combine with per-function AI privileges. Use Cortex Code to audit AI function usage, then implement USE AI FUNCTION per-function privileges for least-privilege AI access control. The governance skills and AI security model compose naturally.Build domain-specific classifiers. The built-in categories cover standard PII/PHI/PCI patterns. For industry-specific identifiers — member IDs, policy numbers, account codes, NPI numbers — build custom classifiers and layer them on top.Governance-as-code. Export your classification profiles, masking policy templates, and quality thresholds into version-controlled SnowflakeCLI or Terraform configurations. That prevents configuration drift when accounts scale, and gives you reproducible governance baselines across development, staging, and production environments.Start HereThe governance gap isn’t a knowledge problem. Most teams know what good governance looks like — classified data, consistent masking, proactive quality monitoring, auditable access trails.It’s an execution problem. The tooling has always demanded more specialization and more time than most organizations can sustain across the full governance surface area.Data Governance Skills in Cortex Code lower that barrier to a natural language prompt.Start with one question: “What is my governance maturity score?”Run it in Cortex Code today. Whatever it returns — whether it shows strong classification coverage with gaps in monitoring, or no baseline at all — that’s your number. Everything after that is progress you can measure, report, and build on.Before You GoIf this article saved you time, gave you a prompt you’ll actually use, or helped you explain governance to a stakeholder — hit the clap button. Up to 50 claps per reader, and it takes two seconds.Share it with one person on your team who still files tickets for access audits.And if you want the next article before it hits the feed — follow Snowflake Chronicles on Medium (@snowflakechronicles). Every piece comes with full, unabridged code, production context, and the parts most articles leave out.Connect on LinkedIn: @satishkumar-snowflakeDisclaimer: The views shared here are my own and do not represent Snowflake or my current or previous employer. This article is for educational purposes only. Features, pricing, and availability may change over time. Some capabilities referenced may be in preview or regionally restricted. Always refer to the official Snowflake documentation for current availability before building production workflows.#Snowflake #DataGovernance #CortexCode #DataEngineering #SnowflakeAI #DataQuality #Compliance #SnowflakeChronicles #HorizonCatalog #DataStewardshipYou Don’t Need a Ticket to Govern Your Data Anymore: Cortex Code Data Governance Skills was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.