Snowflake Row Permissions Policies Masking Policies Documentation

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up data rules by linking roles to table filters and column masks. The official snowflake row permissions policies masking policies documentation explains these two native controls. Data teams use these rules to filter rows and rewrite sensitive columns at query time. When a role has broad permissions, users can still pull too much raw data. Overly broad roles also let scripts run big exports during an active session. How snowflake row permissions policies masking policies documentation

Database Masking Policies + Snowflake Access Control: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up data rules by linking roles to table filters and column masks. The official snowflake row permissions policies masking policies documentation explains these two native controls. Data teams use these rules to filter rows and rewrite sensitive columns at query time. When a role has broad permissions, users can still pull too much raw data. Overly broad roles also let scripts run big exports during an active session.

How snowflake row permissions policies masking policies documentation works in practice

Snowflake uses two main policy types to control what data a role can read. A row policy acts like a hidden filter on a table or view. When a user runs a query, the database checks their active role first. The engine then returns only the rows that match the rule for that role. A masking policy works on columns instead of rows. It rewrites matched fields in results, such as emails, phone numbers, or card numbers. You write a rule that checks the active role during the query run. Privileged roles read the clear text, while other roles get masked text back. Both policies stay attached to the table object inside the data warehouse. Any tool or script using that role gets the exact same filtered view.

How to plan roles and policy mapping

Good policy design starts with a clean role layout in your account. Teams often split roles by job function and data sensitivity level. One admin role creates the policies and attaches them to the right tables. Doing this split stops regular analysts from dropping or changing the active rules. Next, teams map out which columns hold emails, phone numbers, or national IDs. You can apply one central masking rule across many similar columns at once. For row rules, teams often build a mapping table inside the warehouse. This table pairs user roles with specific region codes or department IDs. The row policy reads this mapping table each time a query runs. Keeping the mapping table clean makes role updates fast for the whole team.

What native policies solve and what they leave open

Native warehouse rules work well to filter static tables by user role. They keep analysts from reading regional rows or clear card numbers in daily reports. Yet these native rules only check who holds the role at login. They do not inspect what individual statements or commands do in flight. An engineer with a high role needs clear data to fix a live bug. Once that session starts, the warehouse allows every query from that privileged role. The native setup cannot pause a risky delete command for a quick peer check. It also cannot mask emails or phone numbers for one ad-hoc query alone. Plus, each database brand uses its own policy syntax and role setup. Teams running Postgres, MySQL, and cloud warehouses must build separate rules for each store.

Database Masking Policies + Snowflake Access Control: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

What is the difference between a row policy and a masking policy?

A row policy hides whole records that do not match the user role rule. A masking policy keeps the row visible but rewrites specific column values in results.

Can both policies run on the same table at the same time?

Yes, you can attach both policy types to a single table or view. The engine filters the allowed rows first and then rewrites the masked columns.

What happens when a service account needs broad permissions for an app?

Service roles often skip strict row rules so the app can read all records. If an engineer logs in with that role, the native rules will not block queries.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.