SNOW-2372686: Write large_pandas_backend_df.to_snowflake() via parquet.#3820
Merged
sfc-gh-mvashishtha merged 8 commits intoOct 1, 2025
Conversation
Signed-off-by: sfc-gh-mvashishtha <mahesh.vashishtha@snowflake.com>
…end-df-to-snowflake-performance
Signed-off-by: sfc-gh-mvashishtha <mahesh.vashishtha@snowflake.com>
Signed-off-by: sfc-gh-mvashishtha <mahesh.vashishtha@snowflake.com>
sfc-gh-joshi
left a comment
Contributor
There was a problem hiding this comment.
Very cool! That's an impressive perf graph.
Left a few comments.
sfc-gh-jkew
reviewed
Sep 30, 2025
…sions.py Co-authored-by: Jonathan Shi <149419494+sfc-gh-joshi@users.noreply.github.com>
Signed-off-by: sfc-gh-mvashishtha <mahesh.vashishtha@snowflake.com>
Signed-off-by: sfc-gh-mvashishtha <mahesh.vashishtha@snowflake.com>
…end-df-to-snowflake-performance
sfc-gh-jkew
approved these changes
Oct 1, 2025
sfc-gh-joshi
approved these changes
Oct 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To implement to_snowflake() for a Snowpark pandas dataframe on the pandas backend with large enough data, upload data via a parquet file instead of via a Snowpark dataframe. The Snowpark dataframe typically inserts values through parametrized SQL queries.
Benchmarking showed that a good threshold to switch to parquet was roughly 3 MB, so I've set that as the configurable default switching threshold. Performance of this approach seems to improve with dataset size. Exporting an 800 MB dataframe took about 55 seconds via parquet versus about 429 seconds via the old method, so we get over 7x speedup.
This work took me much longer than expected, so I am sending out this PR with just the changes for DataFrame.to_snowflake(). We can address Series.to_snowflake() separately.
We can take a similar approach to speed up pandas_backend_df.move_to('snowflake').
benchmark script with a 3XL warehouse