Implementing Row-Level Access Policies in BigQuery for Regional Data Isolation

ADP By islever Editorial Last updated

Configure access control and governance.

Short answer

B Create a row-level access policy to dynamically filter sales transaction rows based on the sales representative's region assignment.

Question

You are a database administrator managing sales transaction data by region stored in a BigQuery table. You need to ensure that each sales representative can only see the transactions in their region. What should you do?
  1. Add a policy tag in BigQuery.
  2. Create a row-level access policy. Correct Answer
  3. Create a data masking rule.
  4. Grant the appropriate IAM permissions on the dataset.

Key Takeaways

BigQuery row-level access policies enable dynamic filtering of table rows based on user identity. Option B is correct because it allows restricting transaction visibility by region, unlike IAM, masking, or tags which handle broader access or column-level privacy.

Expert Analysis

BigQuery clustering by region column physically co-locates rows with similar region values, optimizing queries that filter by region. Partitioning (A) splits by date, not region. Materialized views (C) cache results but don't physically sort rows. Partition filter (D) is for partition pruning.

The core challenge presented is implementing a security mechanism where visibility of data is strictly tied to the user's identity or role within the context of specific data attributes (regions). While the reference explanation provided in the source material contains significant technical inaccuracies regarding the definitions of the options—specifically conflating row-level access policies with clustering and mislabeling partitioning as option A—the correct answer remains B because it is the only option that describes a valid Row-Level Security (RLS) mechanism in BigQuery.

Let us analyze why Option B is the correct choice despite the flawed justification text. In BigQuery, Row-Level Access Policies are a feature designed exactly for this scenario: controlling which rows a user can see based on their identity and custom functions. By creating a policy that references the current user's email or role and comparing it against the 'region' column in the sales transaction table, you enforce that a representative for 'North America' cannot query or see rows tagged with 'Europe'. This is a governance and access control task, falling squarely under Data Management objectives. The policy acts as a filter applied at query time, ensuring that even if a user has read access to the dataset, they only receive the subset of data they are authorized to view.

Now, let us evaluate why the other options fail in this specific context:

Option A suggests adding a policy tag. In BigQuery, Policy Tags are part of the Dynamic Data Masking framework. They are used to classify sensitive columns (like PII) and apply masking rules (e.g., showing only the last four digits of a phone number) when users without specific clearance query the data. Policy Tags do not restrict which rows a user can see; they mask values within columns. Therefore, they cannot enforce regional isolation of transactions.

Option C proposes creating a data masking rule. Similar to Policy Tags, data masking rules alter the display of data content (e.g., hiding credit card numbers) rather than restricting the set of rows accessible to a user. Masking does not prevent a user from seeing a row; it only obscures specific fields within that row. It is insufficient for row-level isolation requirements.

Option D suggests granting appropriate IAM permissions on the dataset. IAM roles such as bigquery.dataViewer grant access to the entire dataset or table. They operate at the object level, not the row level. You cannot assign an IAM role that says "User X can see rows where Region = 'West'" while denying them access to other rows in the same table using standard IAM. IAM provides coarse-grained access control, whereas the requirement here is fine-grained, row-level control.

It is critical to note that the reference explanation’s assertion that "Partitioning (A) splits by date" is misleading in the context of identifying the correct security feature. While partitioning by date is a common optimization strategy, partitioning itself is not a security mechanism. Furthermore, the explanation incorrectly attributes the function of "clustering" to Option B. Clustering organizes data physically for performance, not security. However, among the choices, only Row-Level Access Policies provide the functional capability to restrict row visibility based on user attributes. The question tests the distinction between data governance/security features (RLS) versus data organization/optimization features (Clustering/Partitioning) and data masking techniques. For an exam candidate, recognizing that "Row-Level Access Policy" is the specific BigQuery term for dynamic row filtering based on user identity is the decisive factor, regardless of the distractors' descriptions.

This scenario highlights the importance of understanding BigQuery’s layered security model: IAM for table/dataset access, Row-Level Access Policies for dynamic row filtering, and Policy Tags/Masking for column-level sensitivity. Confusing these layers leads to incorrect architectural decisions.

Exam Strategy

When asked about restricting visibility of specific rows based on user attributes, immediately look for 'Row-Level Access Policies' or 'Dynamic Data Masking' (if column-level). Do not confuse these with IAM roles (object-level) or Clustering/Partitioning (performance-level). Remember that RLS uses JavaScript functions to evaluate conditions against the current user context.

Practice All ADP Questions

Access 65 questions with complete answers and detailed explanations.

View Full ADP Practice Test →

← Back to ADP Study Guide