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

feat: Grant ownership follow up tasks [FOR LATER] #2670

Closed
wants to merge 7 commits into from

Conversation

sfc-gh-jcieslak
Copy link
Collaborator

@sfc-gh-jcieslak sfc-gh-jcieslak commented Apr 3, 2024

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.

Copy link

github-actions bot commented Apr 3, 2024

Integration tests failure for bbb917b105b7e49c162017b157621841e73eb1b6

@sfc-gh-jcieslak sfc-gh-jcieslak force-pushed the grant-ownership-follow-up-tasks branch from bbb917b to eac42cc Compare April 4, 2024 09:16
@sfc-gh-jcieslak sfc-gh-jcieslak marked this pull request as ready for review April 4, 2024 09:17
Copy link

github-actions bot commented Apr 4, 2024

Integration tests failure for eac42cc69d65b2178abd8e44d293fdeeeb102cb6

Copy link

github-actions bot commented Apr 8, 2024

Integration tests failure for 1448561dee41f83dae334d7260b2cd931eb55be5

@sfc-gh-jcieslak sfc-gh-jcieslak changed the title feat: Grant ownership follow up tasks feat: Grant ownership follow up tasks [FOR LATER] Apr 8, 2024
changes after review

wip

wip

wip

wip

Adjust grant ownership on pipe to be less hacky without any additional grants underneath

fixes after review

fixes after review

fixes after review

wip

wip

wip

wip

wip

wip

wip

wip

wip

wip

wip

wip
@sfc-gh-jcieslak sfc-gh-jcieslak force-pushed the grant-ownership-follow-up-tasks branch from 1448561 to 3cf9e9c Compare April 8, 2024 13:14
Copy link

github-actions bot commented Apr 8, 2024

Integration tests failure for 3cf9e9c89ad668bc3d216468da192080de29ed7e

Copy link

github-actions bot commented Apr 8, 2024

Integration tests failure for 85f09f56cdc4f476f50652b03180e451999a62fc

sfc-gh-jcieslak added a commit that referenced this pull request Apr 9, 2024
Changes:
- The follow-up grant ownership PR adds support to grant ownership on
Tasks.
- Add a reminder to the documentation to always copy the state file
before applying any state-manipulating functions.
- Added GrantOptionFor option during revoke in privilege-granting
resources, so only with_grant_option will be removed instead of the
whole grant, making the process less destructive

## Test Plan
<!-- detail ways in which this PR has been tested or needs to be tested
-->
* [x] acceptance tests
* [x] integration tests

## References
*
#2670
Another solution for granting ownership `on all tasks` - to be
considered in the future.
* [Grant
Ownership](https://docs.snowflake.com/en/sql-reference/sql/grant-ownership)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant