Repository navigation
SNOW-4537762: Reuse the JDBC connection across process() calls in DataFrameReader.jdbc - #4518
Open
sfc-gh-yuwang wants to merge 3 commits into
Open
sfc-gh-yuwang wants to merge 3 commits into
sfc-gh-yuwang wants to merge 3 commits into
Conversation
read.jdbc() embedded the user query unescaped inside a SQL string literal when calling the infer-schema UDTF, so any query= containing string literals, backslashes or newlines failed (or was silently altered). Escape it with str_to_sql; the ingestion path is unchanged. Generated with [Snowflake CoCo](https://docs.snowflake.com/en/user-guide/cortex-code/cortex-code) Co-authored-by: Snowflake CoCo <noreply@snowflake.com>
…dbc-query-literals # Conflicts: # CHANGELOG.md
…aFrameReader.jdbc Snowflake can route several partition rows to one UDTF handler instance, so the read UDTF must not close its connection after the first partition. Open the connection lazily, close per-call statements/result sets on exhaustion or error, and close the connection in endPartition(). The infer-schema UDTF now also closes its connection on error. Generated with [Snowflake CoCo](https://docs.snowflake.com/en/user-guide/cortex-code/cortex-code) Co-authored-by: Snowflake CoCo <noreply@snowflake.com>
sfc-gh-yuwang
requested review from
sfc-gh-aling,
sfc-gh-jzeng and
sfc-gh-yixie
and removed request for
a team
November 18, 2026 18:41
2 tasks done
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## yuwang/SNOW-4522827-jdbc-query-literals #4518 +/- ##
========================================================================
Coverage 95.55% 95.55%
========================================================================
Files 179 179
Lines 47039 47039
Branches 8140 8140
========================================================================
Hits 44947 44947
Misses 1304 1304
Partials 788 788 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
5 of 11 tasks
Base automatically changed from
yuwang/SNOW-4522827-jdbc-query-literals
to
main
November 18, 2026 23:49
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stacked on #4515 (part of the
read.jdbc()GA epic SNOW-4522813). Review only the top commit.Summary
Snowflake can route several partition rows to one UDTF handler instance, so the
read UDTF must not close its connection after the first partition. Open the
connection lazily, close per-call statements/result sets on exhaustion or error,
and close the connection in endPartition(). The infer-schema UDTF now also
closes its connection on error.
Test plan
tests/unit/test_data_source.py(new regression tests fail without the fix)tests/integ/datasource/test_jdbc.pyagainst live Oracle, PostgreSQL, MySQL and SQL Server (42 passed on the stack tip)Generated with Snowflake CoCo