dbt-bigquery icon indicating copy to clipboard operation
dbt-bigquery copied to clipboard

[Feature] support `grant_access_to` for materialized views

Open frans-k opened this issue 1 year ago • 3 comments

Is this a new bug in dbt-bigquery?

  • [X] I believe this is a new bug in dbt-bigquery
  • [X] I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

We currently grant access to views with this config:

salesforce:
  +grant_access_to:
    - project: data-lake
      dataset: salesforce

Which works well for views. Now we're transitioning to using materialized views, which doesn't seem to trigger the authorization.

Expected Behavior

I expect views and materialized views to work the same, in the UI there's no discernible difference when granting access, the API seems to be the same.

Steps To Reproduce

  1. Create a source dataset with a table
  2. Create a target model in another dataset, materialized as a materialized view
  3. In the target model, add config to grant access to the source dataset.
  4. Run the models
  5. Check if materialized view is listed under authorized views on the source dataset

Relevant log output

No response

Environment

- OS: Debian 12
- Python: Python 3.9.18
- dbt-core: 1.7.6
- dbt-bigquery: 1.7.6

Additional Context

No response

frans-k avatar Mar 21 '24 14:03 frans-k

Materialized views don't currently support grant_access_to, though that would definitely be useful. I'm going to update this to a feature request so that it can be prioritized against the feature backlog.

mikealfare avatar Mar 22 '24 15:03 mikealfare

so this chunk of code in dbt-bigquery's view materialization will need to somehow make it into the "materialized_view" materialization.

https://github.com/dbt-labs/dbt-bigquery/blob/955afbd74b19d37f6c7919a4a92dd2cc50eae905/dbt/include/bigquery/macros/materializations/view.sql#L21-L25

dataders avatar Mar 25 '24 18:03 dataders

so this chunk of code in dbt-bigquery's view materialization will need to somehow make it into the "materialized_view" materialization.

https://github.com/dbt-labs/dbt-bigquery/blob/955afbd74b19d37f6c7919a4a92dd2cc50eae905/dbt/include/bigquery/macros/materializations/view.sql#L21-L25

Presumably? I'd need to look more into it. And then we would want a test or two for it as well, and we'd need to update the docs.

mikealfare avatar Mar 26 '24 09:03 mikealfare