Skip to content

SNOW-3972121: tolerate extra CURRENT_DATABASE/SCHEMA queries in stored-proc tests - #4320

Merged
sfc-gh-bkogan merged 1 commit into
test-v1.53.1from
bkogan/SNOW-3972121-test-v1.53.1-query-count
Aug 19, 2026
Merged

sfc-gh-bkogan merged 1 commit into
test-v1.53.1from
bkogan/SNOW-3972121-test-v1.53.1-query-count

Conversation

@sfc-gh-bkogan

@sfc-gh-bkogan sfc-gh-bkogan commented Aug 19, 2026 •

Copy link
Copy Markdown
Collaborator

Snowfort 10.30.100 clones test-v1.53.1 because information_schema.packages still lists snowpark 1.53.1, but the stored-proc runtime is 1.54.0 with snowflake-connector-python >= 4.7.1. That connector no longer caches database/schema after CREATE TEMP TABLE/STAGE, so extra SELECT CURRENT_DATABASE() / SELECT CURRENT_SCHEMA() queries show up and exact query-count asserts fail.

This is not a 1.53.1 product regression. The same Snowfort mismatch already filed as SNOW-3958345 on 10.30.10. The test-side fix is already on main / test-v1.54.0. This ports it onto test-v1.53.1 so Snowfort stops failing on the branch it actually clones.

Tickets

  • SNOW-3972121 (test_cache_result_query: assert 4 == 2)
  • SNOW-3972180 (test_session_stage_created_once: expected call_count == 1, got 3; also test_large_query_breakdown.py)
  • SNOW-3958345 (same failure on 10.30.10)

Already on main

  • #4295 (fb3ac1e79) initial in [1, 3] / in [2, 4]
  • #4298 (b99b89b3d) filter CURRENT_DATABASE/SCHEMA, then assert remaining counts
  • #4299 (4392522fb) _filter_metadata_queries helper in test_large_query_breakdown.py

This PR

  • test_cache_result_query: drop CURRENT_DATABASE/SCHEMA from history, then assert len(filtered_queries) == 2
  • test_session_stage_created_once: assert patched_run_query.call_count in [1, 3]
  • test_large_query_breakdown.py: same metadata-query filter on history and run_query call counts
  1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-3972121
    Also SNOW-3972180

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
      • If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
    • If this is a new feature/behavior, I'm adding the Local Testing parity changes.
    • I acknowledge that I have ensured my changes to be thread-safe. Follow the link for more information: Thread-safe Developer Guidelines
    • If adding any arguments to public Snowpark APIs or creating new public Snowpark APIs, I acknowledge that I have ensured my changes include AST support. Follow the link for more information: AST Support Guidelines
  3. Please describe how your code solves the related issue.

    Filter (or allow) the extra CURRENT_DATABASE/SCHEMA round-trips that connector >= 4.7.1 issues after CREATE TEMP TABLE/STAGE, matching the assertions already on main.

@sfc-gh-bkogan
sfc-gh-bkogan requested a review from a team as a code owner August 19, 2026 18:19
@sfc-gh-bkogan
sfc-gh-bkogan requested review from sfc-gh-jzeng, sfc-gh-mayliu and sfc-gh-yuwang and removed request for a team August 19, 2026 18:19

@snowflake-security-bot snowflake-security-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Snowflake Security Review

Security grade: A — Passed ✅

This PR was classified as LOW risk by the automated pre-screen.

@sfc-gh-bkogan
sfc-gh-bkogan merged commit 95dfa95 into test-v1.53.1 Aug 19, 2026
18 of 29 checks passed
@sfc-gh-bkogan
sfc-gh-bkogan deleted the bkogan/SNOW-3972121-test-v1.53.1-query-count branch August 19, 2026 18:42
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant