-
Notifications
You must be signed in to change notification settings - Fork 478
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-733213: Add ability for write_pandas to truncate table instead of drop table #1413
Comments
Thanks for reporting! This is actually a good onboarding issue :) |
Hi, was that issue already resolved? seems like there is just discrepancy with the documentation regarding when the table truncates. |
This should have been resolved per this docstring: snowflake-connector-python/src/snowflake/connector/pandas_tools.py Lines 230 to 232 in 783732d
|
Reading the code though, it appears to be doing "drop and swap/rename", not truncating. I don't see any "TRUNCATE" string anywhere else in that file... This is on 3.1.1 |
per my personal experience and as @ttzhou pointed out, the code does not behave as the docstring says it so... I submitted a (probable) fix to this issue that makes the code behave like the docstring says it would be. I thought about only fixing the docstring, but I think that we should have the option of truncating the table instead of just dropping it (because we lose any comments or defaults or conditions of the original table). |
Please answer these questions before submitting your issue. Thanks!
What version of Python are you using?
3.9.0
What operating system and processor architecture are you using?
macOS-13.1-x86_64-i386-64bit
pip freeze
)?snowflake-connector-python==2.9.0
Using write_pandas with overwrite=true, the table on Snowflake side is dropped and then recreated. This was decided in this git issue:
#1175
The decision was made in order to maintain the dataframe schema. However, drop tables loses grants on the table.
We would like to have an option that truncates the table instead of dropping the table in order to maintain grants.
The text was updated successfully, but these errors were encountered: