TL;DR
Row-level security filters which rows each role can read, and column masking changes what a role sees in sensitive columns. Snowflake, BigQuery and Databricks evaluate both at query time. Most analytics tools query through one service account, so warehouse policies bound the whole tool. Per-person access has to come from the tool's own roles, on every surface including Slack and AI assistants. AI agents widen the range of questions people ask. Access limits must be enforced below the model, in the connection and the person's role, never in the prompt.
Row-level security (RLS) is a database control that filters the rows a user or role can read from a table, using a policy the database evaluates on every query. A sales manager in Germany queries the orders table and sees German orders; a manager in France runs the same query and sees French ones. Nobody maintains a copy of the table per country.
In analytics, row-level security is one part of data access governance: the rules for who can see which data, through which tools, and how that access is recorded. This guide assumes your data is already in a cloud warehouse such as Snowflake, BigQuery or Databricks, because that is where these policies live. It covers how row-level security and column masking work there, why a BI tool or an AI agent can quietly sidestep them, and how to set up the two layers of access control that keep them in force.
What is row-level security?
Table grants decide whether a role can query a table at all. Row-level security decides which rows of that table it gets back. The policy is usually a boolean expression attached to the table: the database evaluates it for each row, with the identity of the caller as an input, and returns only the rows where it is true. Because the database applies the filter, it holds no matter which tool sent the query.
Common uses in analytics:
- Regions or business units. Country managers see their own country; a regional lead sees the whole region.
- Tenants. In a multi-tenant product, a customer-facing report shows each customer only their own account's data.
- Partners and agencies. An external partner sees the rows for the stores or campaigns they run.
- Restricted records. Test accounts, employees or records under legal hold are excluded for everyone except a small group.
Most teams drive the policy from a mapping table, for example a table of role names and the regions each may see. Access changes then become data changes instead of policy rewrites, and the mapping table itself is easy to review.
Row-level security vs column masking
Row-level security limits which records come back. Column-level controls limit which fields come back, or what values they show. Personal data usually sits in columns (email, phone number, name, IP address), so privacy programs rely on column controls at least as much as on row filters.
| Control | What it restricts | Typical analytics use |
|---|---|---|
| Table and schema grants | Whether a role can query an object at all | Keep raw landing, finance and HR schemas away from the analytics tool |
| Row-level security | Which rows a role gets back | Scope by country, business unit, tenant or partner |
| Column-level access | Whether a role can read a column | Block salary, national ID or health fields entirely |
| Dynamic masking | What value a role sees in a column | Show a hash or *** instead of an email address |
Masking is often the better fit for analytics than blocking a column. A masked email can still be counted as a distinct user, and a deterministic hash of an identifier still joins across tables, while the raw value never reaches a dashboard, an export or a model's context.
How row-level security works in Snowflake, BigQuery and Databricks?
All three warehouses evaluate the policy at query time, against the identity that runs the query. The names and the details differ. The snippets below are illustrative shapes with example table, role and group names; check each vendor's documentation for the options in your edition.
Snowflake: row access policies and masking policies
Snowflake uses row access policies: schema-level objects that take one or more columns as arguments and return a boolean. A policy is attached to a table or view, and context functions such as CURRENT_ROLE() let it decide per caller. Columns are protected separately with masking policies, which return the real value or a masked one depending on the role. Both need Enterprise Edition or higher.
CREATE ROW ACCESS POLICY governance.region_policy
AS (order_region VARCHAR) RETURNS BOOLEAN ->
EXISTS (
SELECT 1
FROM governance.region_access AS m
WHERE m.role_name = CURRENT_ROLE()
AND m.region = order_region
);
ALTER TABLE analytics.orders
ADD ROW ACCESS POLICY governance.region_policy ON (region);BigQuery: row-level access policies and policy tags
BigQuery has row-level access policies. Each policy names the principals it applies to (users, groups or service accounts) and a filter expression, and a principal sees the rows matched by the policies that include it. Once a table has a row-level access policy, a principal that no policy includes gets no rows back. Columns are handled with policy tags: column-level access control blocks a column, and dynamic data masking returns a masked value, such as a hash or a null, instead.
CREATE ROW ACCESS POLICY emea_orders
ON analytics.orders
GRANT TO ('group:emea-analysts@example.com')
FILTER USING (region = 'EMEA');Databricks: row filters and column masks in Unity Catalog
In Databricks, Unity Catalog provides row filters and column masks. Both are SQL user-defined functions: a row filter returns true or false for each row, and a column mask returns the original value or a masked one. They can be attached to a single table, and Databricks recommends attribute-based (ABAC) policies on governed tags when the same rule should cover many tables. A filter that checks group membership can serve many groups with one function.
Why analytics tools and AI agents must respect these policies?
Warehouse policies evaluate against the identity that runs the query. In analytics, that identity is often not the person looking at the chart. Three common patterns break the link.
Shared service accounts
Most BI and analytics tools connect to the warehouse with one service account. The warehouse applies its row and column policies to that account, not to the person who opened the dashboard. Whatever the service account can read, every user of the tool can potentially read, unless the tool restricts it. Some tools can pass each user's own identity through to the warehouse instead, which keeps policies per person but requires every viewer to have a warehouse account and role.
Extracts and copies
A tool that copies data into its own store leaves the warehouse policies behind. Row access and masking policies are attached to warehouse tables; they do not travel with an extract. The copy then needs its own permission model, its own deletion process and its own place in the compliance scope.
AI agents
An AI agent widens the range of questions. A dashboard shows the queries someone designed; an agent tries to answer whatever it is asked, including list the emails of customers who churned last month. If the agent writes its own SQL against a broad connection, it can select any column that connection can read. An instruction in the prompt such as never reveal personal data is not access control: models can be talked out of instructions, and prompt injection can arrive through the data the agent reads. The boundary has to be enforced below the model, in what the connection can read and what the person's role allows, so that a question outside those limits has nothing to reveal.
Agents raise two more questions. Where do query results go? If results are sent to a model provider, that is a data flow your privacy review has to cover. And whose permissions apply? An agent answering in Slack or in someone's AI assistant should apply that person's permissions, not those of whoever set up the integration. How AI agents query your data warehouse covers the query side in more detail.
The two layers of governed access in analytics
A practical setup uses two layers. The warehouse sets the outer boundary for the analytics tool, and the tool's own roles divide that boundary per person.
Layer 1
Warehouse policies on the tool's connection
Set by the data team in Snowflake, BigQuery or Databricks.
- A dedicated, read-only role for the analytics tool
- Grants limited to the modeled analytics schemas
- Masking on personal columns the tool never needs in clear text
- Row policies that remove whole segments, such as test tenants or restricted records
- Applies to every query the tool sends, whoever asked
Layer 2
Roles inside the analytics tool
Set by the data team for each person or group.
- Which projects, tables and metrics each person can use
- Who can edit definitions and who can only read
- The same role in dashboards, scheduled reports, Slack and AI assistants
- No warehouse account needed for each business user
- A per-person query log, which a service account's warehouse history cannot show
The layers do different jobs. The warehouse layer is the guarantee: even a misconfigured tool cannot read what its connection is denied. The tool layer is the per-person policy: it is where marketing gets campaign data and finance gets revenue, without a warehouse role for every employee.
The weak spot is usually the second layer's coverage. A role that holds in the web app but not in the Slack bot, the scheduled email or the MCP connection an AI assistant uses is a gap, and it tends to be found when someone asks the bot a question they could not have asked the dashboard.
Privacy and compliance: keep the data in the warehouse
Row-level security and masking are easiest to prove when the data has one home. Each copy of event or customer data in another vendor's store is another system to secure, certify, cover in a data processing agreement and include in deletion requests. Analytics that queries the warehouse in place keeps those obligations in one place.

- Mask personal data at the source. Fields masked in the warehouse stay masked in every chart, export and agent answer built on them. Most analysis needs counts of distinct users, not their email addresses.
- One deletion workflow. Under GDPR and CCPA, a deletion or anonymization done in the warehouse shows up in later queries. A separate event store needs its own deletion process, and the two can drift apart.
- Two audit trails. Warehouse query history shows what the tool's service account ran. The tool's own log has to show which person, or which agent acting for which person, asked for it. Compliance reviews need both.
- Data residency. If data must stay in a region or a private network, a tool that queries in place, or that can be self-hosted, avoids a second residency question.
- Model data flows. For AI features, record whether query results are sent to a model provider, whether they are retained, and whether they can be used for training.
A checklist for governed access in analytics
Give the tool its own role
Create a dedicated, read-only warehouse role for the analytics tool. Grant it the modeled schemas it needs, not raw landing tables.
Mask what nobody needs in clear text
Attach masking policies to email, phone, name and other personal columns, so the tool's role sees hashes or nulls.
Filter rows the tool should never see
Use row-level security for test tenants, restricted records or regions outside the tool's scope.
Define per-person roles in the tool
Decide which teams see which projects and metrics, and check that the same roles apply in dashboards, scheduled reports, Slack and AI assistants.
Keep both logs
Retain warehouse query history and the tool's per-person query log, and sample both in access reviews.
Decide what reaches a model
For AI features, decide whether query results may be sent to the model provider, and confirm they are not used for training.
Governed access in Mitzu
Mitzu is an analytics platform on your data warehouse for BI, product analytics and experiment analysis, where the data team governs the metrics and everyone uses them through dashboards, an AI agent, Slack and their own AI assistants. It follows the two layers above.
- Warehouse policies apply to Mitzu's connection. Mitzu queries the warehouse in place with the connection credentials the data team sets up, so row-level security and masking policies defined in Snowflake, BigQuery or Databricks apply to every query it runs. Masked PII stays masked, and no data is copied out.
- Mitzu roles follow each person to every surface. The data team sets who can see what in Mitzu, and that role applies in dashboards, the in-app agent, Slack, MCP clients such as Claude and ChatGPT, and scheduled agents. Each person sees only the data their role allows, and nobody needs a warehouse account. In Slack and MCP clients, these permissions are Mitzu roles, not each person's own warehouse grants.
- The agent does not write SQL. The analytics agent builds an analysis specification on the governed metrics, and a deterministic engine turns it into SQL, which is shown with every answer.
- Logged and controlled. Every query is logged with the user, the timestamp and the full SQL. You decide whether query results are sent to the model, your data is never used to train AI models, and self-hosting and data residency are available.
The data governance page has the details, and MCP and Slack covers how the same permissions reach AI assistants. Start free on your warehouse, or book a demo to see warehouse policies and Mitzu roles working on your own data.
FAQ
What is row-level security in analytics?
Row-level security is a warehouse or database control that filters which rows a user or role can read, using a policy evaluated on every query. In analytics it scopes dashboards, reports and AI answers to the regions, business units, tenants or partners a person may see, without separate copies of the data.
What is the difference between row-level security and column masking?
Row-level security removes whole records from a result. Column masking keeps the records but changes what a role sees in a sensitive column, for example a hash or a null instead of an email address. Analytics teams often use both: row policies for scope and masking for personal data, so counts still work without exposing raw values.
Does row-level security work when a BI tool connects with a service account?
The warehouse applies its policies to the service account, not to each person using the tool. That makes them a boundary for the whole tool, which is useful for masking personal data or excluding restricted records. Per-person restrictions then have to come from the tool's own roles, or from a setup that passes each user's warehouse identity through.
How do AI agents respect row-level security and masking?
Only through controls that sit below the model. The agent's queries run on a connection the warehouse policies apply to, and the analytics tool applies the asking person's role to every answer, including in Slack and AI assistants. Instructions in a prompt are not access control. It also helps when the agent works on governed metric definitions instead of writing free-form SQL against any column the connection can read.
What is data access governance?
Data access governance is the set of policies and controls that decide who can access which data, through which tools and for what purpose, and that record the access for audits. In a warehouse-based analytics stack it covers warehouse roles, row and column policies, the roles inside each analytics tool, and the query logs of both.
