From dca8f75c013b2774e6a1d3696c6865c500f24db2 Mon Sep 17 00:00:00 2001 From: botbikamordehai2-sketch Date: Sat, 15 Aug 2026 09:27:22 +0000 Subject: [PATCH] fix: convert pandas Timestamp to Snowflake-compatible string in write_pandas (closes #991) --- src/snowflake/snowpark/mock/_pandas_util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/snowflake/snowpark/mock/_pandas_util.py b/src/snowflake/snowpark/mock/_pandas_util.py index 7ff3027e72..e4c9927e83 100644 --- a/src/snowflake/snowpark/mock/_pandas_util.py +++ b/src/snowflake/snowpark/mock/_pandas_util.py @@ -95,7 +95,10 @@ def _extract_schema_and_data_from_pandas_df( elif isinstance(plain_data[row_idx][col_idx], pd.Timestamp): if isinstance(data.dtypes.iloc[col_idx], pd.DatetimeTZDtype): # this is to align with the current snowflake behavior that it - # apply the tz diff to time and then removes the tz information during ingestion + # apply the tz diff to time and then removes the tz information d + plain_data[row_idx][col_idx] = plain_data[row_idx][col_idx].tz_convert('UTC').tz_localize(None).strftime('%Y-%m-%d %H:%M:%S.%f') + else: + plain_data[row_idx][col_idx] = plain_data[row_idx][col_idx].strftime('%Y-%m-%d %H:%M:%S.%f')uring ingestion plain_data[row_idx][col_idx] = ( plain_data[row_idx][col_idx] .tz_convert("UTC")