-
Notifications
You must be signed in to change notification settings - Fork 449
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-977384: write_pandas
does not seem to re-use the provided open connection.
#1814
Comments
write_pandas
does not seem to re-use the provided open connection.write_pandas
does not seem to re-use the provided open connection.
seems somewhat related to #1313 but not entirely sure if it's the same issue given the level of details provided. |
i did just discover from looking at the source that EDIT: seems... that there are |
The import pandas as pd
import snowflake.connector.pandas_tools
cur.execute("create or replace table foobar (id int)")
# confirm it exists
cur.execute("select * from foobar").fetchall()
df = pd.DataFrame.from_records(
[
{"ID": 1},
{"ID": 2},
]
)
snowflake.connector.pandas_tools.write_pandas(conn, df, "foobar") The issue is write_pandas is quoting the table name during the copy, ie: its doing a
By default, Snowflake treats quoted identifiers as case-sensitive. So its looking for a lowercase "foobar" table name, but the table was created as FOOBAR. As a workaround try uppercasing the table name when calling It would be nice to make the |
ah sweet - capitalizing the table name and column names does seem to make my script from above work, thanks! but as you point out it is somewhat confusing to be able to create the table via a statement like would be helpful if we could either:
seems like 2 is how it works on Snowflake Worksheets UI so likely is the preferable solution? |
Ah so there's a
Seems like using |
it seems like you have figured out the root cause and found the parameter to control the quotes. is there any other help you need? |
all good on my end - used some other workaround even prior to reporting this issue :.) would it be a breaking change, though? i thought making this change would not break any of the current usage (it would become more permissive, right?). |
Python version
3.8.17
Operating system and processor architecture
macOS-13.5-arm64-arm-64bit
Installed packages
What did you do?
the simple script above behaves as expected, i.e. it is able to:
test
.however, when the write portion of this script has been switched out with
write_pandas
it fails with this:it should be reproducible via:
write_pandas
call fails to find the temporary table that was created right before.What did you expect to see?
included in the "what did you do"
The text was updated successfully, but these errors were encountered: