Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 7 commits into from
Sep 30, 2024

Conversation

mikealfare
Copy link
Contributor

@mikealfare mikealfare commented Sep 20, 2024

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

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX

@mikealfare mikealfare self-assigned this Sep 20, 2024
@mikealfare mikealfare requested a review from a team as a code owner September 20, 2024 23:37
@cla-bot cla-bot bot added the cla:yes label Sep 20, 2024
@mikealfare mikealfare marked this pull request as draft September 20, 2024 23:37
@mikealfare mikealfare changed the title Fix database role grants [Bug] Fix issue where dbt-snowflake attempts to drop database roles during grants sync Sep 27, 2024
@mikealfare mikealfare marked this pull request as ready for review September 27, 2024 23:17
@mikealfare mikealfare merged commit 5b595fb into main Sep 30, 2024
19 checks passed
@mikealfare mikealfare deleted the fix-database-roles branch September 30, 2024 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Materializations fail when database roles are used
2 participants