SNOW-2912540: add IS_V5_DRIVER constant; use it for SecretDetector/TelemetryData/TelemetryClient/ReauthenticationRequest imports and pandas/pyarrow/numpy resolution - universal core transition - #4358
Merged
Conversation
…ersal core transition
…into analyzer_utils - universal core transition
…lemetry_oob - universal core transition
sfc-gh-fpawlowski
requested review from
sfc-gh-bkogan,
sfc-gh-jzeng and
sfc-gh-yuwang
and removed request for
a team
September 9, 2026 20:14
sfc-gh-yuwang
approved these changes
Sep 10, 2026
The 'Update branch' merge pulled in main's still-unrefactored snowflake.connector.secret_detector/telemetry_oob imports alongside this branch's already-local ones, causing flake8 F401 (unused TelemetryService) and F811 (duplicate SecretDetector).
…lemetryData/TelemetryClient/ReauthenticationRequest imports and pandas/pyarrow/numpy resolution - universal core transition Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Filip Pawłowski <sfc-gh-fpawlowski@users.noreply.github.com> Co-authored-by: Yuyang Wang <yuyang.wang@snowflake.com>
sfc-gh-fpawlowski
force-pushed
the
SNOW-2912540-secret-detector-import
branch
from
September 11, 2026 12:44
0ad62d4 to
dd2cba2
Compare
Base automatically changed from
SNOW-2912540-decouple-oob-telemetry
to
main
September 11, 2026 13:39
sfc-gh-fpawlowski
enabled auto-merge (squash)
September 11, 2026 13:39
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4358 +/- ##
==========================================
- Coverage 95.48% 95.44% -0.04%
==========================================
Files 172 173 +1
Lines 44824 44880 +56
Branches 7694 7701 +7
==========================================
+ Hits 42799 42837 +38
- Misses 1252 1265 +13
- Partials 773 778 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
IS_V5_DRIVER: bool = connector_version[0] >= 5to_internal/utils.py— a single canonical place for code that needs to branch on connector generation (legacy v3/v4 vs Universal Driver v5+). Originally opened as its own PR (SNOW-2912540: add IS_V5_DRIVER constant for version-conditioned connector imports #4310); folded in here since every other change in this PR is gated on it.snowflake.connector.secret_detectordoes not exist in v5 (UD) —SecretDetectorlives atsnowflake.connector._common.secret_detector. Fixed with anIS_V5_DRIVER-gated conditional import inmock/_telemetry.py.snowflake.connector.optionsalready providesMissingOptionalDependency,ModuleLikeObject, andpyarrowon both driver generations — no gap to fill. Re-import these from the connector, gated onIS_V5_DRIVER, instead of redefining them locally in_internal/utils.py.installed_pyarrowis now imported directly on v5 (UD PR [Local Testing] SNOW-904981 Support Column bitwise operations and unary minus expression #1151 fixed it to checkpyarrowindependently instead of mirroringinstalled_pandas) but still derived locally viaisinstanceon v4 (not exported there at all).MissingPandasis imported only on v4 (UD PR [Local Testing] SNOW-904981 Support Column bitwise operations and unary minus expression #1151 deleted it outright on v5 — no replacement, perBehaviorDifferences.yamlFix drop columns of dataframe join #66); a_missing_pandas()helper builds the sentinel with whichever construction style each driver generation supports, so callers don't need their ownIS_V5_DRIVERbranch._internal/utils.py's pre-existing_pandas_importer()(a second, independent pandas-resolution attempt that predates this whole effort) in favor of sourcingpandas/installed_pandasfrom the sameIS_V5_DRIVER-gated import as the rest of these names. Dedupsmock/_options.py's numpy handling againstconnector._common.extras.numpyon v5 (confirmed pure duplicate; v4 keeps its ownMissingNumpysince v4'soptions.pyhas no numpy handling to delegate to). Originally opened as a separate PR (SNOW-2912540: remove _pandas_importer(), dedup mock/_options.py numpy handling #4317); folded in here since the diff was small._internal/telemetry.py'sTelemetryClient/TelemetryFieldimport was completely unconditional, pointing at the top-levelsnowflake.connector.telemetrymodule — a real implementation on v4, but a"""BACKWARD COMPATIBILITY MODULE ONLY"""stub on v5. Gated onIS_V5_DRIVER: v5 now imports from_common.telemetry, matching UD PR SNOW-946900: Add internal parameter in stored proc registration to allow forcing inline code #1106's current branch (verified directly —_internal/telemetry.pyno longer exists there at all, fully moved). This same commit also corrects this file'sTelemetryDataimport, which an earlier commit here pointed at_internal.telemetry— that class moved to_commontoo on the same SNOW-946900: Add internal parameter in stored proc registration to allow forcing inline code #1106 branch since that earlier fix landed, so it was already stale for the identical reason.server_connection.pyimportedReauthenticationRequestunconditionally fromsnowflake.connector.network— that module doesn't exist in UD at all (legacy'serrors.py/network.pysplit is consolidated intoerrors.py). UD PR SNOW-1023214: Support date_part argument in last_day #1224 (open, stacked on SNOW-964034 Enable skipped multistmt tests for stored proc #1133) addsReauthenticationRequest(ProgrammingError)toerrors.pyand removesnetwork.pyoutright, naming Snowpark's import site explicitly as the target. Gated the import (and its unit test mock intest_server_connection.py, which had the same unconditional-import bug) onIS_V5_DRIVER._missing_pandas()(had zero coverage aftertest__pandas_importer()was deleted alongside_pandas_importer()itself).tests/integ/test_function.py,tests/integ/test_cte.py,tests/integ/scala/test_datatype_suite.py,tests/integ/scala/test_update_delete_merge_suite.py) that unconditionally importedinstalled_pandasfromsnowflake.connector.options— that module is deleted outright in UD PR [Local Testing] SNOW-904981 Support Column bitwise operations and unary minus expression #1151 (confirmed:f61156c7ais an ancestor ofSNOW-2912540-extras-to-common's current tip).IS_V5_DRIVER-gated options/pandas/pyarrow block out of_internal/utils.pyinto a new, dedicated_internal/options.py— mirrors the connector's ownoptions.py/_common.extras1:1, and mirrorsmock/_options.py's existing role as the scoped equivalent for local testing. Updated all 17 consumers (includingtypes.py, whose multi-line import a naive single-line grep initially missed — caught by a regex-based sweep afterward).options.pycomputes its ownIS_V5_DRIVERrather than importing it fromutils.py, sinceutils.pyitself needs names back fromoptions.py(its modin-optional-dependency code) — importing in both directions would be circular.Still open: UD PRs #1151, #1152, #1106, #1133, and #1224 are unmerged. This PR's
IS_V5_DRIVER=Truepaths are written against their current source but unverifiable end-to-end until they merge.Test plan
LocalTestOOBTelemetryService.export_queue_to_string()still callsSecretDetector.mask_secretscorrectly with both v4 and v5 connectorsgrep -rn "_pandas_importer" src/ tests/→ nothing;grep -rn "MissingNumpy" src/→ only inmock/_options.py's v4 branch;grep -rn "connector\.network\b" src/ tests/unit/→ only the v4 branch of the gated imports;grep -rn "connector\.options" tests/integ/→ nothing left; zero remaining imports of the moved names from_internal.utils(regex-based multi-line sweep, not just single-line grep)black/flake8clean on all 20 touched filesIS_V5_DRIVER=Truepaths againstconnector._common.extras/_common.telemetry/errors.ReauthenticationRequestonce UD PR [Local Testing] SNOW-904981 Support Column bitwise operations and unary minus expression #1151/ [Local Testing] SNOW-850263 Support Dataframe case insensitive collect #1152/SNOW-946900: Add internal parameter in stored proc registration to allow forcing inline code #1106/SNOW-964034 Enable skipped multistmt tests for stored proc #1133/SNOW-1023214: Support date_part argument in last_day #1224 mergeChecklist