snowflakedb / snowflakedb/snowpark-python
SNOW-801653: To add COPY GRANTS in DataFrameWriter.save_as_table function
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 341
- Forks
- 155
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 27
Description
What is the current behavior?
There is no implementation to execute COPY GRANTS while replacing a table.
E.g:
When we execute this command:
df.write.mode("overwrite").save_as_table("table1")
We will lose the grants from the table1.
More information: https://docs.snowflake.com/en/sql-reference/sql/create-table#label-create-table-copy-grants
What is the desired behavior?
In the function save_as_table to add the parameter copy_grants: bool = False. Then we can define if we want to copy or not the grants.
E.g:
df.write.mode("overwrite").save_as_table("table1", copy_grants=True)
Then the new table will have the grants from the replaced table.
How would this improve snowflake-snowpark-python?
In SQL table creation we have this feature, but in snowpark we don't have. So, this feature is important when we want to migrate or create python models.
References, Other Background
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the DataFrameWriter.save_as_table function and review the Snowflake CREATE TABLE COPY GRANTS documentation linked in the issue. Add the optional copy_grants parameter with a false default, then verify that overwrite behavior preserves grants when it is true and does not when it is false.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100