dbt-bigquery
dbt-bigquery copied to clipboard
drop the grants of authorized view when it's full refresh
resolves dbt-labs/dbt-adapters#573
Problem
When you delete a view in BigQuery, all associated dataset grant access are lost because they are tied to the view's ID rather than its name. Consequently, during a full refresh that involves dropping the view, the old grants are not automatically removed and new ones must be created. This oversight can lead to various bugs and inconsistencies.
Solution
Delete the grant to the dataset when we are on full refresh
Checklist
- [x] I have read the contributing guide and understand what's expected of me
- [x] I have run this code in development and it appears to resolve the stated issue
- [x] This PR includes tests, or tests are not required/relevant for this PR
- [x] This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX
Mind adding another functional test?
Should be able to just copy TestAccessGrantSucceeds -> TestAccessGrantSucceedsWithFullRefresh and add some validation the expected grants are/not present:
https://github.com/dbt-labs/dbt-bigquery/blob/main/tests/functional/adapter/test_grant_access_to.py#L80
Thank you for your feedback, Colin. I tried to address all the points you raised in your review.