-
Notifications
You must be signed in to change notification settings - Fork 473
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-582728: Invalid Pyarrow Timestamps Returned #1108
Labels
Comments
github-actions
bot
changed the title
Invalid Pyarrow Timestamps Returned
SNOW-582728: Invalid Pyarrow Timestamps Returned
Apr 27, 2022
6 tasks
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨ Are there any updates to this? I also see other related open issues:
Minimal repro: python3 -m venv snowflake-test-venv
snowflake-test-venv/bin/pip install "snowflake-connector-python[pandas]"
snowflake-test-venv/bin/python from snowflake.connector import connect
from snowflake.connector.pandas_tools import write_pandas
import pandas
from datetime import datetime, timedelta
conn = connect(...)
conn.cursor().execute('CREATE OR REPLACE TABLE "foo" ("a" TIMESTAMP_NTZ)')
test_dates = [
datetime(1970, 1, 1),
datetime(2000, 1, 1),
datetime(2000, 1, 1) + timedelta(microseconds=1),
datetime(2000, 1, 1) + timedelta(microseconds=10),
datetime(2000, 1, 1) + timedelta(microseconds=61),
datetime(2000, 1, 1) + timedelta(seconds=1),
datetime(2000, 1, 1) + timedelta(days=1),
]
df = pandas.DataFrame({"a": test_dates})
write_pandas(conn, df, "foo")
results = conn.cursor().execute('SELECT "a"::string FROM "foo"').fetchall()
for date, (result,) in zip(test_dates, results):
print(f"{date:%Y-%m-%dT%H:%M:%S.%f} => {result:>27}") This outputs:
which shows that just plain |
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was tested using Snowflake Python Connector version 2.7.6 on a Python 3.8 environment:
Output:
This is possible due to nano precision limits in Arrow data and is addressed by PR 1104
The text was updated successfully, but these errors were encountered: