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-687991: Align the table_name quotation in save_as_table() and write_pandas() #604

Closed
ChuliangXiao opened this issue Nov 2, 2022 · 1 comment
Labels
feature New feature or request

Comments

@ChuliangXiao
Copy link
Contributor

What is the current behavior?

  • snowpark_df.write.save_as_table('abc') creates a table ABC in snowflake
  • session.write_pandas(pandas_df, 'abc') creates a table abc in snowflake
  • session.write_pandas(pandas_df, 'abc', quote_identifiers=False) creates a table ABC in snowflake

What is the desired behavior?

  • session.write_pandas(pandas_df, 'abc') creates a table ABC in snowflake
  • session.write_pandas(pandas_df, 'abc', quote_identifiers=True) creates a table abc in snowflake

How would this improve snowflake-snowpark-python?

Make writing Snowflake Table consistent

References, Other Background

As explained in write_pandas docs

quote_identifiers – By default, identifiers, specifically database, schema, table and column names (from DataFrame.columns) will be quoted. If set to False, identifiers are passed on to Snowflake without quoting, i.e. identifiers will be coerced to uppercase by Snowflake.

@ChuliangXiao ChuliangXiao added the feature New feature or request label Nov 2, 2022
@github-actions github-actions bot changed the title Align the table_name quotation in save_as_table() and write_pandas() SNOW-687991: Align the table_name quotation in save_as_table() and write_pandas() Nov 2, 2022
@sfc-gh-yixie
Copy link
Collaborator

sfc-gh-yixie commented Nov 3, 2022

Thanks @ChuliangXiao pandas columns are case sensitive. For instance, ab and aB are two different column names. If they're not quoted, the would both become AB after writing to a table. So write_pandas quote the column names by default and therefore quote the table name too.

Aside from dealing with pandas DataFrame, we try to follow the Snowflake object identifier requirements.

But this is indeed confusing to users. We'll think of a way to improve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants