snowpark-python icon indicating copy to clipboard operation
snowpark-python copied to clipboard

SNOW-801653: To add COPY GRANTS in DataFrameWriter.save_as_table function

Open calixtofelipe opened this issue 1 year ago • 3 comments

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

calixtofelipe avatar Apr 25 '23 22:04 calixtofelipe

thank for the feedback, @sfc-gh-yixie @sfc-gh-jdu what's your thoughts on introducing the copy_grants to save_as_table?

sfc-gh-aling avatar May 15 '23 22:05 sfc-gh-aling

@sfc-gh-aling , thanks for thinking about it. Just a plus comment I already create a PR with the changes: https://github.com/snowflakedb/snowpark-python/pull/813 In my company's project, we have been using this implementation, because the grant request process is automated and if we need to change something in the table, we lose the grants. It is difficult to explain to the user that access has been lost and we need to grant it again. =)

calixtofelipe avatar May 16 '23 18:05 calixtofelipe

Hi, has there been any update on supporting this? There doesn't seem to be any update here or in the linked PR for several months.

eugene-roach avatar Nov 30 '23 21:11 eugene-roach