CertSafari
    Databricks Certified Data Engineer Associate· Lessons

    Domain 7 · Lesson 33/33

    Unity Catalog ABAC policies and governed tags

    Understand Unity Catalog ABAC policies to centrally control row-level filtering and column masking for sensitive data

    23 min read
    3.75% of exam
    7 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    What you will be able to do

    • Explain how an ABAC policy differs from an object-level GRANT and why it still depends on one
    • Describe governed tags, who can create and assign them, and how tag inheritance affects table and column conditions
    • Read and write a CREATE POLICY statement for a row filter or column mask using scope, TO/EXCEPT, WHEN and MATCH COLUMNS
    • Trace how Unity Catalog evaluates policies at query time, including conflicts and fail-closed behaviour
    • Choose between ABAC policies and table-level row filters and column masks for a given governance setup

    Key concept

    ABAC policy — An ABAC policy is a single CREATE POLICY definition attached to a metastore, catalog, schema or table. For the principals it names, it applies a row filter or column mask to every table and column whose governed tags match its conditions, and it is evaluated again on every query.

    1.Access decided by tags, not by per-table rules

    Attribute-based access control (ABAC) in Unity Catalog decides which rows and column values a user sees by checking attributes on the data, not rules written onto each table. The attributes are governed tags placed on catalogs, schemas, tables and columns. A policy lists the tag conditions it cares about, and any object whose tags match those conditions falls under it. So one policy attached to a catalog can protect every sensitive table in that catalog, whoever owns the table.

    Policies are evaluated dynamically. They are not snapshots computed when the policy is created. When someone creates and tags a new table, any policy whose conditions it matches applies to it straight away, and nobody writes a new policy definition. Retagging a table, or adding or removing a user from a group, changes which policies apply on the next query.

    ABAC does not replace object privileges. A principal still needs SELECT on a table, plus USE CATALOG and USE SCHEMA above it, to query it at all; those come from object-level GRANT statements. A row filter or column mask policy only narrows what an already-permitted query returns. Policies name their targets in a TO list of users, groups or service principals. One policy can cover a whole group such as account users, so nobody needs a separate policy per person.

    Checkpoint 1 of 10· Check yourself

    A catalog-level column mask policy masks columns tagged pii and has TO account users. A data steward creates a new table in that catalog and tags its email column pii. An analyst in account users has USE CATALOG and USE SCHEMA, but no one has granted them SELECT on the new table. What happens when the analyst queries it?

    Checkpoint 2 of 10· Exam question

    In Unity Catalog, what is the defining characteristic of an ABAC (attribute-based access control) policy compared to a standard GRANT statement on an object?

    Sources123

    2.Governed tags: the attributes policies match on

    A governed tag is a tag defined at the account level, and every governed tag has a tag policy. Administrators use it to mark a key as governed, fix the set of allowed values, and decide who may assign the tag. Users can still apply the tag to any object it fits. The difference is that only users with the right permission can set its value, and only to one of the allowed values. Because the definition lives at the account level, a key such as pii or sensitivity means the same thing in every workspace and across metastores.

    This control is what makes tags safe to base access policy on. If any table owner could make up sensitivity = hgh, or strip pii from a column, a policy keyed on those tags would quietly stop matching. Three permissions control the tags themselves. Account admins hold all three on the account by default and can grant them to users, groups and service principals.

    Permissions on governed tags
    PermissionWhat it allowsScope
    CREATECreate new governed tagsAccount
    MANAGEEdit, delete, and assign permissions for governed tagsAccount or individual governed tag
    ASSIGNAssign governed tags to Unity Catalog objectsAccount or individual governed tag

    Tags inherit downward, but they stop at the column. A tag on a catalog or schema passes to the objects below it, and you can override it at each level. Column tags never inherit from the table and must be applied to the column itself. This affects the two tag functions every policy uses, has_tag('key') and has_tag_value('key', 'value'). In a table condition (WHEN), they see tags set on the table or inherited from its catalog or schema. In a column condition (MATCH COLUMNS), they see only tags set on the column. So in a schema tagged pii, no column matches has_tag('pii') until someone tags that column.

    Checkpoint 3 of 10· Check yourself

    A schema is tagged pii. One of its tables has an ssn column tagged pii, and its other columns have no tags. A policy on the catalog uses WHEN has_tag('pii') and MATCH COLUMNS has_tag('pii'). For a principal in the TO list, which columns of that table get masked?

    Sources452

    3.Anatomy of a CREATE POLICY statement

    Every row filter or column mask policy answers four questions: where it is attached (scope), whom it applies to (principals), what it does (the action) and which tables and columns it targets (conditions). The policy below answers all four. It is attached to catalog_a, applies to all account users except HR admins, and masks every column tagged PII in tables tagged HR.

    A column mask policy with a table condition (WHEN) and a column condition (MATCH COLUMNS)sql
    CREATE POLICY mask_pii_for_hr
    ON CATALOG catalog_a
    COLUMN MASK mask_pii
    TO `account users` EXCEPT `HR admins`
    FOR TABLES
    WHEN has_tag('HR')
    MATCH COLUMNS has_tag('PII') AS pii_col
    ON COLUMN pii_col;
    CREATE POLICY clauses and what each controls
    ClauseWhat it controls
    ON { METASTORE | CATALOG | SCHEMA | TABLE }Scope: the policy evaluates against all tables, including views, that descend from this object
    TO principalUsers, groups, or service principals subject to the policy
    EXCEPT principalExempt principals, who see full, unmodified data
    FOR TABLESTargets tables, including views; there is no separate FOR VIEWS syntax
    WHEN conditionWhich tables in scope the policy applies to, by tag; defaults to TRUE if omitted
    MATCH COLUMNS condition AS aliasWhich columns the policy targets, each given an alias
    ON COLUMN aliasColumn masks only: the matched column to mask
    USING COLUMNS (...)Arguments passed to the UDF: aliases from MATCH COLUMNS or constant literals

    Scope decides how far a policy reaches, so attach it as high as the rule allows, usually the catalog. A catalog-level policy covers every table in every schema of that catalog. A metastore-level policy (Beta) covers every catalog. WHEN then narrows the scope to tables with certain tags, and MATCH COLUMNS picks out columns. Every MATCH COLUMNS expression must find a match before the policy applies to a table.

    Here is how the pieces combine. A retailer tags many tables in a catalog sensitivity = high, and in each of them tags the region column geo_region. One row filter policy does the job: attached ON CATALOG, TO us_analysts, with WHEN has_tag_value('sensitivity','high') and MATCH COLUMNS has_tag('geo_region'). It hides European rows in every table that follows this pattern, including tables tagged next year. The alternatives all need per-table work. You could run ALTER TABLE ... SET ROW FILTER on each table, or build and grant a dynamic view over each one. A dynamic view is a new object whose logic sits in its own definition, so it protects only the tables it selects from.

    The action reuses the two UDF contracts of table-level row filters and column masks: a boolean for each row, or a replacement value for each column. ABAC attaches them through tags across every matching table, instead of with ALTER TABLE one table at a time. To create a policy you need MANAGE on the object it attaches to (or ownership of it) and EXECUTE on the UDF. You also need Databricks Runtime 16.4 or above, or serverless compute.

    Checkpoint 4 of 10· Fill the gap

    This policy should mask PII columns only inside tables tagged HR, and leave PII columns in other tables of catalog_a alone. Which keyword goes in the blank?

    CREATE POLICY mask_pii_for_hr
    ON CATALOG catalog_a
    COLUMN MASK mask_pii
    TO `account users` EXCEPT `HR admins`
    FOR TABLES
     ?  has_tag('HR')
    MATCH COLUMNS has_tag('PII') AS pii_col
    ON COLUMN pii_col;

    Checkpoint 5 of 10· Exam question

    A retail company tags many tables across a catalog with sensitivity = high and tags the relevant column in each of those tables with geo_region. The governance team wants European customer rows hidden from the us_analysts group everywhere this pattern occurs, without editing every individual table. Which approach satisfies this requirement?

    Sources263

    4.Row filter and column mask policies in practice

    A row filter policy hands each row's values to a UDF that returns a boolean, and rows where it returns FALSE are dropped from the result. In the policy below, MATCH COLUMNS finds whichever column carries the region tag in each table and calls it rgn. USING COLUMNS passes that column and the constant 'EMEA' to the function, which returns region = allowed. The EMEA team sees only EMEA rows in every table in sales that has a column tagged region. Because the constant is a policy argument, another team's policy can reuse the same function with a different region.

    Row filter policy: one function, applied to every sales table with a region-tagged columnsql
    CREATE POLICY regional_access_emea
    ON CATALOG sales
    ROW FILTER filter_by_region
    TO `emea team`
    FOR TABLES
    MATCH COLUMNS has_tag('region') AS rgn
    USING COLUMNS (rgn, 'EMEA');

    A column mask policy hands the column value to a UDF that returns either the original or a masked version. The masked column is passed in automatically as the first argument, from ON COLUMN, and USING COLUMNS adds any further arguments. Below, the constant 4 tells mask_ssn to keep the last four digits and return ***-**- followed by them. The return type must match the column's data type or be castable to it. The policy sits on hr_catalog, so every column tagged pii = ssn is masked for everyone outside the compliance team, in today's tables and in any table tagged later.

    Column mask policy: every column tagged pii = ssn in the catalog, last four digits shownsql
    CREATE POLICY mask_ssn_columns
    ON CATALOG hr_catalog
    COLUMN MASK mask_ssn
    TO `account users` EXCEPT `compliance team`
    FOR TABLES
    MATCH COLUMNS has_tag_value('pii', 'ssn') AS ssn_col
    ON COLUMN ssn_col
    USING COLUMNS (4);

    A policy can use more than one column condition. A row filter policy accepts up to six MATCH COLUMNS expressions and a column mask policy up to three, and all of them must match. The policy below masks email addresses unless the customer has consented to be contacted. It is attached ON SCHEMA customers, and its two conditions each get an alias: m is the column tagged pii : email, which ON COLUMN m marks as the one to mask, and c is the column tagged consent_to_contact. USING COLUMNS (c) passes the consent column to the UDF as its second argument, and the UDF returns the email only when consent = true, otherwise '****@****.***'.

    Column mask policy with two column conditions: m is the column to mask, c is the consent columnsql
    CREATE POLICY mask_email_with_consent
    ON SCHEMA customers
    COLUMN MASK mask_email_by_consent
    TO `account users`
    FOR TABLES
    MATCH COLUMNS has_tag_value('pii', 'email') AS m,
      has_tag('consent_to_contact') AS c
    ON COLUMN m
    USING COLUMNS (c);

    Write the UDF in SQL where you can. Python UDFs registered in Unity Catalog also work, but the query optimizer cannot inline or optimize them the way it can SQL UDFs.

    Checkpoint 6 of 10· Fill the gap

    Every table in the sales catalog has a column tagged region, but the column has a different name in each table. Which argument goes in the blank so the filter function receives that column's value in each table?

    CREATE POLICY regional_access_emea
    ON CATALOG sales
    ROW FILTER filter_by_region
    TO `emea team`
    FOR TABLES
    MATCH COLUMNS has_tag('region') AS rgn
    USING COLUMNS ( ? , 'EMEA');

    Checkpoint 7 of 10· Exam question

    A healthcare organization tags any column that stores a social security number with the governed tag pii = ssn, across dozens of tables in a catalog, and expects new tables added later to be protected automatically. Which Unity Catalog capability meets this requirement without per-table maintenance?

    Sources26

    5.How policies are evaluated at query time

    Evaluation happens on every query, in two stages: Unity Catalog decides which policies apply, then the Databricks Runtime enforces them. For each table in the query, Unity Catalog works through these steps:

    1. Find every policy whose scope covers the table.
    2. Keep only the policies whose TO list includes the querying user and whose EXCEPT list does not.
    3. Check the table against each policy's conditions, including inherited tags. A column condition must match at least one column.
    4. Send the resulting row filter or column mask to the runtime with the table metadata.

    Because the inputs are the user's identity, their group memberships and the current tags, two people running the same query can get different results. Views involve two identities. Access to the underlying tables is checked against the view owner, but policies are evaluated against the person querying. A user can query through a view without direct table access and still get every policy that applies to them. The runtime turns the effective filter or mask into a secure view over the table scan, which is the same mechanism table-level filters and masks use.

    Only one distinct row filter can apply to a given table and user, and only one distinct mask to a given column and user. When more than one applies, Databricks refuses rather than picking one. It raises UC_ABAC_MULTIPLE_ROW_FILTERS or MULTIPLE_MASKS and blocks access to the table. Overlap on its own is not a conflict: two policies that call the same UDF with the same arguments resolve to the same filter and coexist. When a table suddenly starts returning errors, run SHOW EFFECTIVE POLICIES to list every policy that applies to it.

    Checkpoint 8 of 10· Put it in order

    An analyst runs a SELECT on a table in a catalog that has several ABAC policies. Put the steps that decide and enforce what the analyst sees in the order Databricks performs them.

    1. 1.Unity Catalog keeps only the policies whose TO list includes the analyst and whose EXCEPT list does not.
    2. 2.Unity Catalog checks the table's tags, including inherited tags, against each remaining policy's conditions, and each column condition must match at least one column.
    3. 3.Unity Catalog finds every policy whose scope covers the queried table.
    4. 4.Unity Catalog sends the resulting row filter or column mask to the Databricks Runtime with the table metadata.
    5. 5.The runtime query planner turns the effective filter or mask into a secure view over the table scan.

    Sources7

    6.Fail-closed: denial instead of exposure

    ABAC fails closed. If Databricks cannot guarantee that every applicable policy is enforced, it denies access rather than returning unprotected data.

    The same rule covers operations that cannot work with filters or masks in place. They fail rather than bypass enforcement. To run one, the executing principal must be in the EXCEPT list of every ABAC policy that applies to the table. That principal is exempt, so there is nothing to enforce. Operations that need this exemption include:

    • Access from Databricks Runtime versions below 16.4
    • Deep and shallow cloning
    • OpenSharing, where the share owner must be exempt; the policy does not govern the recipient's access
    • AI Search index creation and syncing

    Pipeline refreshes, backup processes and admin workflows often run into this, so service principals that run them usually belong in EXCEPT.

    A policy also fails closed when something it depends on disappears. If someone deletes a governed tag that a policy references, every query on the policy's object and its children fails with UC_ABAC_UNKNOWN_TAG_POLICY, even on tables that never had the tag. The UI and API don't stop the deletion, so check for referencing policies first. Deleting a UDF that a policy uses gives UC_DEPENDENCY_DOES_NOT_EXIST. To fix either error, restore the tag or function, or change the policy.

    Tagged columns are protected from deletion, and this regularly breaks automated jobs. A declarative pipeline that tries to drop a column with a governed tag fails. To unblock it, someone with ASSIGN on the tag and APPLY TAG on the object must remove the tag, let the pipeline run, then reapply the tag. If they skip the last step, queries fail, because the policy is still in scope but the tag it expects is gone.

    Checkpoint 9 of 10· Check yourself

    Your nightly backup job runs as the service principal backup-sp and deep clones a table in a protected catalog. Two ABAC policies apply to the table: a row filter policy whose EXCEPT list includes backup-sp, and a column mask policy that does not exempt it. What happens when the job runs?

    Sources7

    7.Choosing ABAC or table-level filters and masks

    The two approaches differ mainly in who controls the rule. A table-level filter or mask is set with ALTER TABLE on one table, and the table owner can change or remove it. An ABAC policy lives on the catalog, schema or table it is attached to. Once it is set at a higher level, individual table owners can't remove, modify or bypass it. That lets a central security team enforce one rule over dozens of tables owned by different teams.

    ABAC policies compared with table-level row filters and column masks
    ConsiderationABAC policiesTable-level filters and masks
    SQL syntaxCREATE POLICY ... ON CATALOG/SCHEMA/TABLEALTER TABLE ... SET ROW FILTER / ALTER COLUMN ... SET MASK
    ScopeAll tables in scope and descendants; new tagged tables covered automaticallyOne table; each configured individually
    MatchingDynamic, via has_tag() and has_tag_value()Bound to specific tables and columns
    Targeted principalsTO/EXCEPT clauses, plus identity functions in the UDFIdentity functions like current_user() in the UDF
    Who can change itSet by catalog or schema owners; table owners cannot overrideTable owners can modify or remove
    InspectingSHOW EFFECTIVE POLICIES, DESCRIBE POLICY, SHOW POLICIESINFORMATION_SCHEMA.ROW_FILTERS and INFORMATION_SCHEMA.COLUMN_MASKS

    ABAC is the better choice when the same rule should hold across many tables, schemas or catalogs, and when new tables should be covered as soon as they are tagged. It also suits organisations that split the work: policy authors write the rules and data stewards tag the data. And it is the only choice when some principals need an EXCEPT exemption to run cloning or OpenSharing. Table-level filters and masks win when a table's logic is specific and doesn't carry over to other tables, when owners should manage their own protection without a central tag system, and when the set of tables is small and rarely changes. The two can sit on the same table, subject to the one-distinct-filter-or-mask rule.

    Checkpoint 10 of 10· Match them up

    Match each governance tool to the requirement it serves best.

    Tap a term, then the definition that fits it.

    Sources3

    Sources

    (7)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “access is determined by evaluating attributes associated with securable objects”
      ↩︎ Access decided by tags, not by per-table rules
      “a single policy can enforce consistent access rules across an entire metastore, catalog, or schema”
      ↩︎ Key concept
    2. 2.
      “As new data objects are created and tagged, the policy applies automatically without requiring separate policy definitions for each object.”
      ↩︎ Access decided by tags, not by per-table rules
      “The TO clause specifies the users, groups, or service principals subject to the policy.”
      ↩︎ Access decided by tags, not by per-table rules
      “you can use the same tag taxonomy across your entire data estate in an account, including across multiple metastores”
      ↩︎ Governed tags: the attributes policies match on
      “column tags do not inherit from the parent table and must be applied directly”
      ↩︎ Governed tags: the attributes policies match on
      “Databricks recommends attaching policies at the highest applicable level, usually the catalog, to maximize governance efficiency.”
      ↩︎ Anatomy of a CREATE POLICY statement
      “Rows where the function returns FALSE are excluded from query results.”
      ↩︎ Row filter and column mask policies in practice
      “The masked column value is bound automatically as the first argument from the ON COLUMN clause”
      ↩︎ Row filter and column mask policies in practice
      “This allows a single UDF to be reused across policies with different parameters.”
      ↩︎ Row filter and column mask policies in practice
      “If a table does not have columns matching both conditions, the policy does not apply and the data is returned unmasked.”
      ↩︎ Row filter and column mask policies in practice
      “SQL UDFs are recommended for better performance.”
      ↩︎ Row filter and column mask policies in practice
      “Tags don't propagate from tables to columns.”
      ↩︎ Exam trap 2
      “In column conditions (MATCH COLUMNS), checks tags set directly on the column only — does not match table tags.”
      ↩︎ Checkpoint
    3. 3.
      “both add restrictions on top of existing object-level privileges”
      ↩︎ Access decided by tags, not by per-table rules
      “Use row filters and column masks when you want to control access on individual tables without introducing new objects.”
      ↩︎ Anatomy of a CREATE POLICY statement
      “each table must be configured individually, and table owners can modify or remove their own filters and masks”
      ↩︎ Choosing ABAC or table-level filters and masks
      “individual table owners can't remove, modify, or bypass it”
      ↩︎ Choosing ABAC or table-level filters and masks
      “Your organization separates duties. For example, policy authors define rules, and data stewards classify data with tags.”
      ↩︎ Choosing ABAC or table-level filters and masks
      “Each table has strict, specific logic that doesn't generalize to other tables.”
      ↩︎ Choosing ABAC or table-level filters and masks
      “both add restrictions on top of existing object-level privileges”
      ↩︎ Exam trap 1
      “Databricks evaluates conflict by comparing the functions applied, not the data output.”
      ↩︎ Exam trap 3
      “individual table owners can't remove, modify, or bypass it”
      ↩︎ Exam trap 5
      “Neither approach grants access to data on its own — both add restrictions on top of existing object-level privileges.”
      ↩︎ Checkpoint
      “Databricks evaluates conflict by comparing the functions applied, not the data output.”
      ↩︎ Prediction
      “Policies can be set by catalog or schema owners. After being set at a higher level, table owners cannot override, modify, or remove them.”
      ↩︎ Checkpoint
    4. 4.
      “Governed tags are account-level tags with built-in rules for consistency and control.”
      ↩︎ Governed tags: the attributes policies match on
      “only users with the appropriate permissions can assign values to that tag, and only from a predefined set of allowed values”
      ↩︎ Governed tags: the attributes policies match on
    5. 5.
      “Account admins have CREATE, MANAGE, and ASSIGN privileges on the account by default.”
      ↩︎ Governed tags: the attributes policies match on
    6. 6.
      “The policy evaluates against all tables, including views, that are descendants of this securable object.”
      ↩︎ Anatomy of a CREATE POLICY statement
      “All expressions must match for the policy to apply.”
      ↩︎ Anatomy of a CREATE POLICY statement
      “and EXECUTE on the UDF that implements the filtering or masking logic”
      ↩︎ Anatomy of a CREATE POLICY statement
      “A row filter policy can include up to six MATCH COLUMNS expressions, and a column mask policy can include up to three.”
      ↩︎ Row filter and column mask policies in practice
    7. 7.
      “Changes to group membership or tag assignments dynamically alter the effective policies at query time.”
      ↩︎ How policies are evaluated at query time
      “Access to the underlying tables is checked against the view owner's identity, while policies are evaluated against the querying user's identity”
      ↩︎ How policies are evaluated at query time
      “This is the same enforcement mechanism used for table-level row filters and column masks.”
      ↩︎ How policies are evaluated at query time
      “Only one distinct row filter can be applied at query time for a given table and user.”
      ↩︎ How policies are evaluated at query time
      “two policies that reference the same UDF with the same arguments resolve to the same filter or mask, and don't conflict”
      ↩︎ How policies are evaluated at query time
      “Use SHOW EFFECTIVE POLICIES to see all policies that apply to the table.”
      ↩︎ How policies are evaluated at query time
      “ABAC follows a fail-closed model, where Databricks defaults to denying access if it cannot verify security.”
      ↩︎ Fail-closed: denial instead of exposure
      “the principal must be listed in the EXCEPT clause of every ABAC policy that applies to the table”
      ↩︎ Fail-closed: denial instead of exposure
      “This occurs even if the tag was not applied to the queried tables.”
      ↩︎ Fail-closed: denial instead of exposure
      “The UI and API do not prevent deleting a governed tag that is referenced in an ABAC policy.”
      ↩︎ Fail-closed: denial instead of exposure
      “Databricks prevents deleting a column that has a governed tag applied.”
      ↩︎ Fail-closed: denial instead of exposure
      “the principal must be listed in the EXCEPT clause of every ABAC policy that applies to the table”
      ↩︎ Exam trap 4
      “If the policy applies, determines the effective row filter or column mask and sends it to the Databricks Runtime as part of the table metadata.”
      ↩︎ Checkpoint
      “the query fails closed (access is denied) to prevent unprotected data exposure”
      ↩︎ Prediction
      “To run them, the principal must be listed in the EXCEPT clause of every ABAC policy that applies to the table.”
      ↩︎ Checkpoint

    Spotted a mistake, or was something unclear? Tell us.