-
Notifications
You must be signed in to change notification settings - Fork 144
Description
Describe the bug
When using the materializations pit_incremental
or bridge_incremental
, Grant statements defined in the dbt_project or in models directly are not being executed at all, not even for models with other materializations like the official materializations provided by dbt.
We are aware that the PIT and BRDIGE macros have been deprecated in the latest version of AutomateDV, however, it would be great if this can still be fixed to ensure users can still make use of those macros until alternatives are provided.
Environment
dbt version: 1.7.13
automate_dv version: 0.11.0
Database/Platform: Snowflake
To Reproduce
Steps to reproduce the behavior:
[Option 1] Test in production
- Add a grant statement for an existing database role e.g. in the dbt_project for a directory or model that is materialized as
pit_incremental
orbridge_incremental
- Merge the changes and run the PROD pipeline
- Check the grants on the respective tables in Snowflake by running
show grants on table <database_name>.<schema_name>.<table_name>;
- The database role that has actually been assigned in dbt has not been granted
[Option 2] Test locally
- Add a grant statement for a database role that does not exist e.g. in the dbt_project for a directory or model that is materialized as
pit_incremental
orbridge_incremental
- Execute a
dbt_run
for the respective model - Then dbt run will be successful (although it should fail)
Expected behavior
[Option 1]
The database role that has been assigned in dbt should be granted to the respective table(s)
[Option 2]
The dbt run should fail and a SQL compilation error should be thrown stating that "Role '<role_name>' does not exist or not authorized", given that the role name does actually not exist.
Screenshots
dbt_project config for Business Vault
Additional context
In version 1.2 dbt has added the execution of Grant configs to their materialization macros (Commit). However, it seems like this hasn´t been added to the AutomateDV materialization macros for PIT and BRIDGE tables.
Code Suggestions
I created this pull request with the proposed changes. We tested the changes ourselves and it solved the issue.