Snowpark has a problem / bug that it does not maintain the types between Pandas and Snowpark, nor does it allow to manually set its schema.
For instance,
df1 = session.sql(sql).to_pandas()
df2 = session.create_dataframe(df)
The timestamp field on df1
with TimestampType
has become a LongType
.
I've also tried to store the schema and use it, but same results.
df1 = session.sql(sql)
df1_schema = df1.schema
df1 = df1.to_pandas()
df2 = session.create_dataframe(df, df1_schema)
Has anyone managed to deal with it?
This stops me from being able to write the DataFrame
back to the table as it needs to be of TimestampType
rather than LongType
.