Looker Anonymization
You achieve looker anonymization by writing user attribute rules in your semantic data models. You can also redact fields in the database before reports run. Teams often start by adding conditional logic to each report view. This setup breaks down when analysts receive broad permissions or run custom SQL queries. How native looker anonymization works in the semantic layer Looker reads data from your database using a central modeling layer. Data engineers define tables, dimensions, and measure
Anonymization Techniques: the complete guide
Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.
You achieve looker anonymization by writing user attribute rules in your semantic data models. You can also redact fields in the database before reports run. Teams often start by adding conditional logic to each report view. This setup breaks down when analysts receive broad permissions or run custom SQL queries.
How native looker anonymization works in the semantic layer
Looker reads data from your database using a central modeling layer. Data engineers define tables, dimensions, and measures inside these model files. To hide private fields, engineers tie field definitions to user attributes. A user attribute holds a group name or a role value for each person.
When a business user opens a dashboard, the platform checks their assigned user attribute. The tool then builds a SQL query based on that attribute value. If the user lacks clearance, the model replaces the column with a hash or text. This method rewrites matched fields like emails or phone numbers in the report output. Users with higher permissions still see the normal values in their dashboards.
Teams also use column level grants inside the modeling layer to restrict sensitive dimensions. If a person lacks the right grant, the query fails or drops the column. This keeps standard dashboard viewers from pulling card numbers or national IDs. Engineers must write and update these rules for every single sensitive field.
What model rules solve and where gaps remain
Semantic layer rules work well for standard dashboard users who only view prebuilt charts. These rules give data teams version control over how business metrics and dimensions appear. Still, model logic only applies when queries pass through the semantic layer.
Many analysts and developers use the built-in SQL Runner tool to query the database. SQL Runner sends raw queries straight to the database using the shared database credentials. It skips the semantic layer and all user attribute rules defined in your models. Anyone with SQL Runner permissions can read unmasked tables that the database user can read.
Anonymization Techniques: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
A second risk comes from the single shared database account that runs these queries. Most teams set up the platform with one service account that holds broad read permissions. The platform decides who logs in to the web app, not what SQL statements return. If an engineer creates a new table column, it stays exposed until someone updates the model.
Why database views alone are hard to maintain
To fix the SQL Runner gap, some teams build masked views inside the database. They create separate database accounts for different groups of analysts and dashboard viewers. Each database role reads from a specific set of views that hash emails or phone numbers.
This approach moves the burden from the BI tool to the data engineering team. Engineers must copy views and manage database grants every time a schema changes. When teams connect multiple tools like Python scripts or notebooks, view drift happens fast. Keeping masking logic consistent across every database engine takes constant manual work.
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
Does Looker anonymize data in SQL Runner?
No, SQL Runner queries the database directly and skips the semantic modeling layer. Any masking rules built on user attributes or model grants will not apply there.
How do user attributes mask fields in reports?
Engineers write conditional SQL inside a dimension that checks a user attribute value. When a regular user runs a report, the query returns a masked string instead.
What happens when new sensitive columns enter the database?
New columns stay unmasked in raw queries until an engineer updates the model definitions. Relying only on manual model updates leaves a window where raw data is exposed.
Related guides
In this post