CertSafari
    Snowflake SnowPro Advanced: MLOps Engineer (MLA-B01)· Lessons

    Domain 5 · Lesson 15/17

    Masking, row access and tag-based policies for ML data

    Enforce Snowflake security policies.

    11 min read
    5.33% of exam
    5 sources
    Published 20 Oct 2026
    Docs as of 4 Oct 2026

    What you will be able to do

    • Explain how a masking policy changes the values a training job or a scoring query receives
    • Write a conditional masking policy that depends on another column of the same table
    • Separate ownership of a row access or masking policy from the right to apply it
    • Use tag-based policies and registry tags to apply one set of governance rules across feature stores and models

    1.Dynamic Data Masking on training and inference data

    Dynamic Data Masking hides column values at query time, so the stored data never changes. What a query sees depends on the role running it. A masking policy is a schema-level object attached to a column of a table or view. When the query runs, Snowflake evaluates the policy and returns the plain value, a partially masked value or a fully masked value, depending on the policy conditions and the role context.

    For ML work, the key rule is that masking applies wherever the column is referenced, not just in the SELECT list. That includes joins, WHERE predicates and GROUP BY. A feature pipeline or a SQL scoring query run under an unprivileged role therefore receives masked inputs. Picture a fraud model trained on clear-text amounts and then scored by analysts who see masked amounts. The model is fed values it never learned from, and its predictions stop making sense. To fix this, the role that runs training and the role that runs inference must receive the same, unmasked view of the features. Loosening the model is the wrong lever.

    A conditional masking policy decides how to mask one column from the values in other columns. The extra columns are passed in as policy arguments, and every column named in the CREATE MASKING POLICY statement must sit in the same table or view. Keep the argument list short, because Snowflake evaluates each column at runtime. A row access policy is the wrong tool for this job, since it removes whole rows instead of masking a value.

    The right to mask is separate from ownership of the data. A security or privacy officer chooses which columns to protect, and a policy can even keep ACCOUNTADMIN and SECURITYADMIN from seeing raw values. Only two privileges control a masking policy. OWNERSHIP gives full control over its definition. APPLY lets a role set the policy on a column or unset it. Every operation also needs a privilege on the parent database and schema.

    Who controls a masking policy
    PrivilegeWhat the holder can do
    OWNERSHIPFull control; required to alter most policy properties; one role at a time
    APPLYSet or unset the masking policy on a column
    APPLY MASKING POLICY on ACCOUNTGlobal apply, which also enables DESCRIBE on tables and views

    Here is how that plays out for a central security team. The team keeps OWNERSHIP and APPLY on the masking policies for ML schemas. ML teams can own the feature tables, but without APPLY they cannot unset a policy or swap in another one. Auditors can check coverage through the POLICY_REFERENCES view, which lists every object with a masking policy set. They should look in the Query Profile for which policies a query used, because policy names do not appear in QUERY_HISTORY.

    Checkpoint 1 of 6· Check yourself

    A fraud model was trained by a data science role that sees clear-text transaction amounts. Analysts now score it with a SQL query under their own role. A masking policy on the amount column hides the value from that role, and the predictions make no sense. What explains this, and what is the right fix?

    Checkpoint 2 of 6· Match them up

    A central security team governs the masking policies on ML feature tables. Match each masking policy privilege to what it lets the holder do.

    Tap a term, then the definition that fits it.

    Checkpoint 3 of 6· Exam question

    A governance engineer wants masking logic that depends on another column, such as showing an email only when a consent flag column is TRUE. Which statement describes how to implement this?

    Sources12

    2.Row access policies on feature and scoring tables

    A row access policy returns a BOOLEAN for each row. Rows that evaluate to FALSE disappear from the query result for that caller. You bind the policy to one or more columns of a table or view. A common pattern looks the caller up in a mapping table: executives see everything, and each manager sees only the regions listed for their role.

    A row access policy with a role check and a mapping-table lookupsql
    CREATE OR REPLACE ROW ACCESS POLICY security.sales_policy AS (sales_region varchar) RETURNS BOOLEAN -> 'sales_executive_role' = CURRENT_ROLE() OR EXISTS ( SELECT 1 FROM salesmanagerregions WHERE sales_manager = CURRENT_ROLE() AND region = sales_region ) ;

    CURRENT_ROLE matches only the primary role in the session, so a manager working through an inherited role is filtered out. When role hierarchy should count, write the conditions with IS_ROLE_IN_SESSION for account roles and IS_DATABASE_ROLE_IN_SESSION for database roles. Policy subqueries run on every query against the table. Replacing the EXISTS lookup with a memoizable function improves performance on large feature tables.

    The schema owner role gets CREATE ROW ACCESS POLICY automatically and can grant it to other roles. Ownership and application are kept apart on purpose. A policy runs with its owner's rights, so the owner should be a low-privilege custom role such as one that can only read the mapping table, never SECURITYADMIN. APPLY goes to whichever role adds the policy to tables or drops it from them.

    Hand ownership to a least-privilege role and APPLY to the role that binds the policysql
    GRANT OWNERSHIP ON ROW ACCESS POLICY security.sales_policy TO mapping_role; GRANT APPLY ON ROW ACCESS POLICY security.sales_policy TO ROLE sales_analyst_role;

    A row filter also applies to training jobs. A dataset generated under a regional manager's role contains only that manager's regions. That is correct for an analyst and a silent sampling bias for a model meant to cover every region. Check which role your training pipeline runs as before trusting its row counts.

    Checkpoint 4 of 6· Check yourself

    SECURITYADMIN has just created a row access policy that limits a scoring table to each manager's regions by looking the caller up in a mapping table. Before the policy goes to production, how should ownership and APPLY be assigned?

    Sources3

    3.Consistent governance across feature stores and model registries

    Tags let one rule cover every feature store and model without listing them one by one. A tag-based policy attaches a masking or row access policy to a tag. Wherever the tag is set, whether on a database, schema, table or column, the policy applies. Tag inheritance carries it down, so tagging a Feature Store schema protects the tables and views in it, including ones producers create next week. Masking columns this way still requires a type match: the column data type must equal the policy's data type.

    Two masking policies attached to one tag, which can then be set on any schemasql
    ALTER TAG governance.tags.ai_governance SET MASKING POLICY account_name_agent_mask, MASKING POLICY account_number_agent_mask;

    Tag-based policies come with a few rules:

    • Tag-based masking is generally available. Tag-based row access, aggregation, projection and join policies are in public preview.
    • A policy assigned directly to an object beats a tag-based policy of the same type on that object.
    • A tag configured to propagate carries its policy to downstream objects that receive data from, or depend on, the tagged object.
    • The POLICY_REFERENCES table function confirms which column, policy and tag are protecting what.

    Model Registry governance also runs on tags, because models are first-class objects whose tags are secured by role-based access control. A production engineering role can own a live_version tag and set its value on a model. Data scientists then keep OWNERSHIP of the model but cannot decide what reaches production. To see a model's tags, the production role needs APPLY TAG on the account. To read the tag values it needs USAGE on the schema, and to create the tag it needs CREATE TAG. When calling SYSTEM$GET_TAG on a model, use the object domain MODULE.

    A production role points the live_version tag at a new model versionsql
    USE ROLE prod_role;
    
    ALTER MODEL model_database.model_schema.my_model
        SET TAG prod_db.prod_schema.live_version = 'V2';

    For the strongest separation, keep production models in a schema of their own. Models there are separate objects with their own access control, so developers can freely change development models without any risk to what production calls. Compliance checks can query INFORMATION_SCHEMA.MODEL_VERSIONS, which lists each version's owner, metadata and functions, and join it to other information schema views.

    Checkpoint 5 of 6· Fill the gap

    Data scientists keep OWNERSHIP of my_model, but a production engineering role decides which version is live. Which keyword completes the statement this role uses to promote V2?

    USE ROLE prod_role;
    
    ALTER MODEL model_database.model_schema.my_model
        SET  ?  prod_db.prod_schema.live_version = 'V2';

    Checkpoint 6 of 6· Check yourself

    The security team sets a tag with a masking policy on a Feature Store schema. Later, one producer team attaches its own masking policy straight to a column of a feature table in that schema. Which policy masks that column now?

    Sources45

    Sources

    (5)

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

    1. 1.
      “uses masking policies to selectively mask plain-text data in table and view columns at query time”
      ↩︎ Dynamic Data Masking on training and inference data
      “A security or privacy officer decides which columns to protect, not the object owner.”
      ↩︎ Dynamic Data Masking on training and inference data
      “Enables executing the unset and set operations for a masking policy on a column.”
      ↩︎ Dynamic Data Masking on training and inference data
      “Masking policy names are not included in the QUERY_HISTORY view.”
      ↩︎ Dynamic Data Masking on training and inference data
      “At query runtime, the masking policy is applied to the column at every location where the column appears.”
      ↩︎ Checkpoint
    2. 2.
      “The masking policy is applied to the column regardless of where in a SQL expression the column is referenced”
      ↩︎ Dynamic Data Masking on training and inference data
      “the query output may not provide the anticipated value because the masked data prevents evaluating”
      ↩︎ Dynamic Data Masking on training and inference data
      “Minimize the number of column arguments in the policy definition.”
      ↩︎ Dynamic Data Masking on training and inference data
      “Ensure all columns specified in the CREATE MASKING POLICY statement reside in the same table or view.”
      ↩︎ Exam trap 1
      “Ensure all columns specified in the CREATE MASKING POLICY statement reside in the same table or view.”
      ↩︎ Prediction
    3. 3.
      “Snowflake recommends that the policy conditions use the IS_ROLE_IN_SESSION function for account roles”
      ↩︎ Row access policies on feature and scoring tables
      “Note that the schema owner role is automatically granted the CREATE ROW ACCESS POLICY privilege.”
      ↩︎ Row access policies on feature and scoring tables
      “The sales_analyst_role custom role can add or drop the row access policy from a table as needed.”
      ↩︎ Row access policies on feature and scoring tables
      “replace the mapping table lookup subquery in the EXISTS clause with a memoizable function.”
      ↩︎ Row access policies on feature and scoring tables
      “Ownership of the policy does not rest with the SECURITYADMIN system role.”
      ↩︎ Exam trap 3
      “policies are executed with owner’s rights, not the more privileged SECURITYADMIN system role. This approach supports the Principle of Least Privilege.”
      ↩︎ Checkpoint
    4. 4.
      “When the tag is assigned to an object (database, schema, table, or column), the policy is automatically applied to that object.”
      ↩︎ Consistent governance across feature stores and model registries
      “when the column data type matches the data type in the masking policy”
      ↩︎ Consistent governance across feature stores and model registries
      “Tag-based aggregation, row access, projection, and join policies are in public preview”
      ↩︎ Consistent governance across feature stores and model registries
      “If you configure your tag to propagate to downstream objects, the tag-based policy protects those downstream objects automatically”
      ↩︎ Consistent governance across feature stores and model registries
      “the directly assigned policy takes precedence”
      ↩︎ Exam trap 2
      “When an object is protected by both a directly assigned policy and a tag-based policy of the same type, the directly assigned policy takes precedence.”
      ↩︎ Checkpoint
    5. 5.
      “Tags are securable by role-based access control and are suitable for this separation of responsibility.”
      ↩︎ Consistent governance across feature stores and model registries
      “The SQL domain of models, for use with SYSTEM$GET_TAG, is MODULE.”
      ↩︎ Consistent governance across feature stores and model registries
      “Because the production models are separate objects with their own access control, you can protect them from accidental modification”
      ↩︎ Consistent governance across feature stores and model registries

    Ready to test yourself?

    Practise the 19 questions on this subdomain.

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