dbt-labs / dbt-snowflake

dbt-snowflake contains all of the code enabling dbt to work with Snowflake
https://getdbt.com
Apache License 2.0
296 stars 176 forks source link

[Bug] Fix issue where `dbt-snowflake` attempts to drop database roles during grants sync #1188

Closed mikealfare closed 1 month ago

mikealfare commented 2 months ago

resolves #1151

Problem

When the user provides a grants config and there is an existing database role with access to a model, dbt-snowflake may attempt to revoke permissions on this database role. dbt-snowflake does not manage database roles so the DDL that is produced is incorrect, resulting in an error. This bug shows up in particular for incremental models where dbt-snowflake attempts to reconcile permissions on a persistent object; normally tables/views are dropped and recreated so there is no need to revoke permissions.

Solution

Remove database roles when standardizing the grants dict, as is done for OWNERSHIP permissions and SHARE grants.

Checklist