- 
                Notifications
    You must be signed in to change notification settings 
- Fork 208
Open
dbt-labs/dbt-bigquery
#1267Labels
feature:materialized-viewsIssues related to materialized viewsIssues related to materialized viewspkg:dbt-bigqueryIssue affects dbt-bigqueryIssue affects dbt-bigquerytype:bugSomething isn't working as documentedSomething isn't working as documented
Description
Is this a new bug in dbt-bigquery?
- I believe this is a new bug in dbt-bigquery
- I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
When using the grants configuration on a materialized view, the generated grant/revoke statement results in:
grant <PRIVILEGE> on materialized_view <MODEL_NAME> to "<GRANTEE_1>","<GRANTEE_2>"and respectively:
revoke <PRIVILEGE> on materialized_view <MODEL_NAME> from "<GRANTEE_1>","<GRANTEE_2>"This results in an error because BigQuery expect the relation type to be materialized view instead of materialized_view.
Expected Behavior
The grant/revoke statements execute successfully.
Steps To Reproduce
- Create a models like the following:
base_table.sql:
{{
    config(
        materialized='table'
    )
}}
SELECT 1 AS testgrants_materialized_view.sql:
{{
    config(
        materialized='materialized_view',
        grants={
            "roles/bigquery.dataViewer": ["user:[email protected]"]
        }
    )
}}
SELECT * FROM {{ ref('base_table') }}- 
Create the models using dbt run
- 
Models should be created and the described privileges granted but the following error occurs: 
Database Error in model grants_materialized_view (models/grants_materialized_view.sql)
  Invalid object type for GRANT statement: materialized_view at [6:5]
  compiled Code at <REDACTED>/grants_materialized_view.sql
Relevant log output
Database Error in model grants_materialized_view (models/grants_materialized_view.sql)
  Invalid object type for GRANT statement: materialized_view at [6:5]
  compiled Code at <REDACTED>/grants_materialized_view.sqlEnvironment
- OS: MacOS
- Python: 3.12
- dbt-core: 1.8.1
- dbt-bigquery: 1.8.1Additional Context
Proposed fix: dbt-labs/dbt-bigquery#1267
Metadata
Metadata
Assignees
Labels
feature:materialized-viewsIssues related to materialized viewsIssues related to materialized viewspkg:dbt-bigqueryIssue affects dbt-bigqueryIssue affects dbt-bigquerytype:bugSomething isn't working as documentedSomething isn't working as documented