In Snowflake, a row access policy is applied to a table to control which rows a user can see based on a condition. Suppose you have a row access policy that allows users to see only rows where the column region matches their assigned region.
What happens when a user queries the table without any row access policy applied?
Think about what happens if no restrictions are applied.
If no row access policy is applied, Snowflake returns all rows in the table without filtering.
Which of the following Snowflake row access policy definitions is syntactically correct?
Assume the policy filters rows where department equals the current user's department.
CREATE ROW ACCESS POLICY dept_policy AS (department STRING) RETURNS BOOLEAN -> department = CURRENT_ROLE();
Check the arrow syntax and comparison operator.
The correct syntax uses AS (params) RETURNS BOOLEAN -> condition; with a single equals sign for comparison.
You manage a Snowflake table with sales data for multiple regions. You want to ensure that users can only see sales data for their assigned region. Which architecture best enforces this using row access policies?
Consider how row access policies can use session variables for dynamic filtering.
Using a row access policy that compares the region column to a session variable holding the user's assigned region allows dynamic, centralized filtering.
Which of the following is a security risk when using row access policies in Snowflake?
Think about how users might manipulate session variables.
If users can change session variables used in row access policies, they might see unauthorized rows, creating a security risk.
Given a Snowflake table employees with a row access policy that only allows rows where department = 'HR', what will be the result of this query by a user without any special roles?
SELECT COUNT(*) FROM employees;
Row access policies filter rows invisibly based on conditions.
The row access policy filters rows so the user only sees rows where department is 'HR', so the count reflects only those rows.