terraform-provider-snowflake icon indicating copy to clipboard operation
terraform-provider-snowflake copied to clipboard

feat: Grant ownership follow up tasks [FOR LATER]

Open sfc-gh-jcieslak opened this issue 10 months ago • 5 comments

Add handling of the grant ownership on tasks.

func (v *grants) grantOwnershipOnAllTasks(ctx context.Context, opts *GrantOwnershipOptions) error {
// grant on all tasks
// 1. grant ownership on all tasks (Snowflake will suspend automatically)
// 2. go through tasks in [database|schema]
// 3. resume w if here last_suspended_reason was equal to "GRANT_OWNERSHIP" (have to resume parent first)
}

The second solution that almost enables us to provide automatic suspend/resume of tasks during grant ownership. This solution, instead of calling grant on all tasks is calling show tasks and going through every task one by one.

The current solution could be better if we could use grant on all tasks and resume tasks that were suspended by grant ownership call. This "may" be possible by utilizing last_suspend_reason_ field returned by SHOW TASKS.

sfc-gh-jcieslak avatar Apr 03 '24 09:04 sfc-gh-jcieslak

Integration tests failure for bbb917b105b7e49c162017b157621841e73eb1b6

github-actions[bot] avatar Apr 03 '24 10:04 github-actions[bot]

Integration tests failure for eac42cc69d65b2178abd8e44d293fdeeeb102cb6

github-actions[bot] avatar Apr 04 '24 09:04 github-actions[bot]

Integration tests failure for 1448561dee41f83dae334d7260b2cd931eb55be5

github-actions[bot] avatar Apr 08 '24 09:04 github-actions[bot]

Integration tests failure for 3cf9e9c89ad668bc3d216468da192080de29ed7e

github-actions[bot] avatar Apr 08 '24 13:04 github-actions[bot]

Integration tests failure for 85f09f56cdc4f476f50652b03180e451999a62fc

github-actions[bot] avatar Apr 08 '24 13:04 github-actions[bot]