Skip to content

SNOW-2912540: inline _create_temp_stage and _create_temp_file_format into analyzer_utils - #4308

Open
sfc-gh-fpawlowski wants to merge 3 commits into
SNOW-2912540-remove-connector-shimsfrom
SNOW-2912540-inline-pandas-staging-helpers
Open

SNOW-2912540: inline _create_temp_stage and _create_temp_file_format into analyzer_utils#4308
sfc-gh-fpawlowski wants to merge 3 commits into
SNOW-2912540-remove-connector-shimsfrom
SNOW-2912540-inline-pandas-staging-helpers

Conversation

@sfc-gh-fpawlowski

@sfc-gh-fpawlowski sfc-gh-fpawlowski commented Aug 6, 2026

Copy link
Copy Markdown

Ports the _create_temp_stage and _create_temp_file_format implementations from the Universal Driver connector (PR snowflake-eng/drivers#518) directly into Snowpark's analyzer_utils.py, removing the dependency on these private snowflake.connector.pandas_tools symbols.

Changes:

  • analyzer_utils.py: Remove the three connector imports (_create_temp_stage, _create_temp_file_format, build_location_helper). Add local implementations of all staging helpers: _qualify_name / build_location_helper, _pandas_generate_temp_name, _pandas_create_temp_object, _stage_sql, _file_format_sql, _create_temp_stage, _create_temp_file_format.
  • Fix the _create_temp_file_format call site in write_arrow: the local impl maps compression internally (like PR SNOW-667858: to_pandas will only convert TimestampTypes to a native pandas date format, and not DateTypes #518), so the caller no longer pre-maps via compression_map[compression].
  • black-format the ported code, and suppress a pyright overload error on the two cursor.execute(..., _force_qmark_paramstyle=True) calls in _pandas_create_temp_object: _force_qmark_paramstyle is declared only on SnowflakeCursor.execute's real implementation signature in snowflake-connector-python, not on either of its two @overload stubs — a latent stub gap invisible while this code lived inside the connector package, now exposed since it lives in Snowpark's own pyright-checked source tree.

Companion: snowflake-eng/drivers#518 (which implements the same functions in the UD connector for its own write_pandas flow — the two implementations are kept in sync).

Checklist

  • I acknowledge that I have ensured my changes to be thread-safe

Stack (via Graphite)

🤖 Generated with Claude Code

…into analyzer_utils

Removes the dependency on these private snowflake-connector-python functions
(previously imported from connector.pandas_tools). Ports the implementation
from universal-driver PR #518 directly into Snowpark so the connector no longer
needs to expose staging helpers as part of its public surface.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ned pandas staging helpers

black never ran on the ported code (4 blocks needed line-wrapping).
The two cursor.execute(..., _force_qmark_paramstyle=True) calls also
fail pyright: SnowflakeCursor.execute's two @overload stubs in
snowflake-connector-python never declare _force_qmark_paramstyle,
only the real implementation signature does. That gap was invisible
while this code lived in the connector package; porting it into
analyzer_utils.py exposes it to Snowpark's own pyright run.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 29.26829% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.99%. Comparing base (b14c893) to head (cb14275).

Files with missing lines Patch % Lines
...lake/snowpark/_internal/analyzer/analyzer_utils.py 29.26% 29 Missing ⚠️
Additional details and impacted files
@@                           Coverage Diff                           @@
##           SNOW-2912540-remove-connector-shims    #4308      +/-   ##
=======================================================================
- Coverage                                89.08%   80.99%   -8.10%     
=======================================================================
  Files                                      170      170              
  Lines                                    44624    44663      +39     
  Branches                                  7675     7677       +2     
=======================================================================
- Hits                                     39755    36174    -3581     
- Misses                                    3721     6969    +3248     
- Partials                                  1148     1520     +372     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants