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

SNOW-1658882: Please provide the option to copy grants when overwriting table using write_pandas #2049

Open
surpatean opened this issue Sep 10, 2024 · 4 comments · May be fixed by #2050
Open
Assignees
Labels
feature status-triage_done Initial triage done, will be further handled by the driver team

Comments

@surpatean
Copy link

surpatean commented Sep 10, 2024

What is the current behavior?

When overwrite=True and auto_create_table=True, the new table created by write_pandas is created with fresh grants.

What is the desired behavior?

I would like the option to copy the grants of the old table to the new table, similar to the optional COPY GRANTS parameter of CREATE OR REPLACE TABLE.

How would this improve snowflake-connector-python?

In some use-cases, it is preferred to have table-level grants, instead of db/schema-level future grants.

If the table needs to be overwritten with a new schema definition (e.g. for schema evolution), the option to maintain the permission profile of the table would be useful.

References and other background

I will follow-up with a PR.

@github-actions github-actions bot changed the title Please provide the option to copy grants when overwriting table using write_pandas SNOW-1658882: Please provide the option to copy grants when overwriting table using write_pandas Sep 10, 2024
@surpatean surpatean linked a pull request Sep 10, 2024 that will close this issue
7 tasks
@sfc-gh-sghosh sfc-gh-sghosh self-assigned this Sep 12, 2024
@sfc-gh-sghosh
Copy link

Hello @surpatean ,

Thanks for raising the request; we are checking and will update you.

Regards,
Sujan

@sfc-gh-sghosh
Copy link

Hello @surpatean ,

We are checking if its feasible to add such feature or not with write_pandas API

Meanwhile, the following workaround can be used

  1. Take a backup of Grants ( SHOW GRANTS ON TABLE <table_name>;)
  2. wite_pandas ( session, <table_name>)
  3. Reapply the grants GRANT SELECT ON TABLE <table_name> TO ROLE ;

Regards,
Sujan

@sfc-gh-sghosh sfc-gh-sghosh added status-triage_done Initial triage done, will be further handled by the driver team status-triage Issue is under initial triage and removed needs triage status-triage_done Initial triage done, will be further handled by the driver team labels Sep 13, 2024
@surpatean
Copy link
Author

surpatean commented Sep 13, 2024

Thank you @sfc-gh-sghosh
I also submitted a PR (based on the SQL copy grants parameter), which I think solves it.

@sfc-gh-sghosh
Copy link

Hello @surpatean ,

Thanks for submitting the PR, we are reviewing it, will update.

Regards,
Sujan

@sfc-gh-sghosh sfc-gh-sghosh added status-triage_done Initial triage done, will be further handled by the driver team and removed status-triage Issue is under initial triage labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants