You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using write_pandas method with auto_create_table as True the code generates a create statement by inferring the column types from the staged dataframe (parquet) file.
The code snippet (from pandas_tools.py) that does this is here:
create_table_sql = (
f"CREATE {'TEMP ' if create_temp_table else ''}TABLE IF NOT EXISTS {location} "
f"({create_table_columns})"
f" /* Python:snowflake.connector.pandas_tools.write_pandas() */ "
)
What is the desired behavior?
It would be handy if we could add an extra argument to the function overwrite that would enable this to be a create or replace with something like:
create_table_sql = (
f"CREATE {'OR REPLACE' if overwrite else ''} "
f"{'TEMP ' if create_temp_table else ''} TABLE"
f"{'IF NOT EXISTS' if not overwrite else ''} {location} "
f"({create_table_columns})"
f" /* Python:snowflake.connector.pandas_tools.write_pandas() */ "
)
How would this improve snowflake-connector-python?
It would enable users to overwrite a table with a dataframe (with potentially different shape and column definitions) without having to run an explicit drop statement first.
References, Other Background
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
Add overwrite option to write_pandas
SNOW-590657: Add overwrite option to write_pandas
May 15, 2022
What is the current behavior?
When using
write_pandas
method withauto_create_table
asTrue
the code generates a create statement by inferring the column types from the staged dataframe (parquet) file.The code snippet (from pandas_tools.py) that does this is here:
What is the desired behavior?
It would be handy if we could add an extra argument to the function
overwrite
that would enable this to be a create or replace with something like:How would this improve
snowflake-connector-python
?It would enable users to overwrite a table with a dataframe (with potentially different shape and column definitions) without having to run an explicit drop statement first.
References, Other Background
The text was updated successfully, but these errors were encountered: