Object reference · Lesson 8 of 8Detailed study · about 12 min

Tags and policies: label data, then enforce rules

A tag labels an object with metadata, such as its business owner or sensitivity. A policy defines enforceable behavior, such as masking values or filtering rows.

Understand the idea

Think of a tag as a label on a document: confidential or owned by finance. The label is useful for discovery and auditing, but writing confidential on a document is not the same as locking it away. Tags can participate in automated governance, but the enforcement must actually be configured.

Key ideas in simple English
ConceptWhat it means
TagA name/value label used for organization and governance.
Masking policyControls the value returned for a column under defined conditions.
Row access policyControls which rows a query can return.
Access grantsStill govern access to objects; policies complement them.

A concrete example

Northstar labels customer email as sensitive. A masking policy can hide its value from an analyst role, while a row access policy can limit a regional team to its own rows.

Remember: A sensitivity label alone does not hide data; enforcement needs the right policy and access design.

Explain it step by step · full theory

Understand the idea

Think of a tag as a label on a document: confidential or owned by finance. The label is useful for discovery and auditing, but writing confidential on a document is not the same as locking it away. Tags can participate in automated governance, but the enforcement must actually be configured.

A masking policy changes what a query sees in a column, depending on its policy logic. A row access policy decides which rows are visible. Neither should be described as deleting or rewriting the underlying values. They operate alongside role privileges.

Follow the example

The SQL is an inventory of governance objects in the lab schema. Tagging, dynamic masking and row access policy features have edition and privilege requirements; these examples do not create or attach policies. Your account may not expose these commands or objects to the current role.

For an actual policy rollout, compare representative allowed and restricted roles. Confirm what each role should see, then inspect the resulting values and row counts. Avoid relying on one powerful administrative role to prove that a restricted learner or analyst gets the correct result.

The fresh basic lab has no such policies or tags. These statements inspect metadata only and do not mask any column or filter ORDERS.

Words used in this lesson
Tag
A name/value label used for organization and governance.
Masking policy
Controls the value returned for a column under defined conditions.
Row access policy
Controls which rows a query can return.
Access grants
Still govern access to objects; policies complement them.

See how it works

Choose a step to explore the idea at your own pace.

Open the interactive explanation
Interactive explainer1 / 3

Tags and policies: label data, then enforce rules

Northstar sales team
Business requirement

Start with the requirement

Northstar labels customer email as sensitive. A masking policy can hide its value from an analyst role, while a row access policy can limit a regional team to its own rows.

Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.

Read the complete diagram explanation
  1. Start with the requirement

    Northstar labels customer email as sensitive. A masking policy can hide its value from an analyst role, while a row access policy can limit a regional team to its own rows.

  2. Choose the objects

    Compare the responsibilities: Tag: A name/value label used for organization and governance.; Masking policy: Controls the value returned for a column under defined conditions.; Row access policy: Controls which rows a query can return.

  3. Explain the outcome

    A sensitivity label alone does not hide data; enforcement needs the right policy and access design.

Try the SQL or command

Read → predict → run in your learning environment → compare. You can also learn by reading without an account.

New to SQL? Where to run it and how to read it

A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.

  1. No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
  2. For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
  3. Read the entire example, including comments beginning with --. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor.
  4. Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
SELECT / FROM
Choose the values to return / identify their input.
VALUES / COLUMN1
VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
AS / WITH
AS gives a result a readable name. WITH names a temporary query step within one statement.
NULL / ::
NULL means missing or unknown. The :: notation converts a value to a named data type.
Session
One connection and its settings. Keep related transaction steps in the same session.
Database.schema.table
A full address for stored data. It is separate from the warehouse that processes queries.
Help with common practice errors
  • No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
  • Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
  • Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
  • Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.

Before running this lesson

Governance features such as object tagging, dynamic data masking and row access policies require Enterprise Edition or higher and the appropriate privileges. Read these as object concepts if your account does not support them.

Read the example

SQL · example
SHOW TAGS IN SCHEMA L2_OBJECTS_LAB.SALES;
SHOW MASKING POLICIES IN SCHEMA L2_OBJECTS_LAB.SALES;
SHOW ROW ACCESS POLICIES IN SCHEMA L2_OBJECTS_LAB.SALES;

What to expect and why

The fresh basic lab has no such policies or tags. These statements inspect metadata only and do not mask any column or filter ORDERS.

Check your understanding

Choose an answer, then check your reasoning. This is practice, not a scored test.

An email column is tagged sensitive. Is it automatically masked?

Try it yourself

Choose a control for hiding email values and a control for restricting a team to its region.

Compare your reasoning

Use masking logic for the email values and row access logic for regional visibility, together with suitable grants. A tag can classify the data, but a label alone is not enforcement.

Official sources and curriculum

Object reference · See module scope