But when i execute dbt run it will set it on table/view level. At my company we wan’t to set these type of view-access to different ad-groups on dataset level. We wan’t to control these through the file dbt_project.yml and not inside every model.
Is there a solution to this? Maybe a macro that will solve it? Or am i just doing it wrong in our dbt_project.yml.
Hello, If you are creating datasets via terraform, then tf would be best place for this use case . If you are looking via dbt please use post hooks (defined in dbt_project.yml) or define macro with list of grant SQL statements and call macro on-run-start or on-run-end based on your use case.
I have done the extensive analysis around grants for bq. You can go thru in below link
dbt doesn’t have a first-class concept of datasets so there is nowhere to hang dataset-level config like grants.
We handled this by removing dbt’s ability to manage datasets (taking away its bigquery.datasets.create permission) and creating datasets with Terraform instead