Skip to content

NO-SNOW Propagate unrecognised driver parameters as session parameters#737

Merged
sfc-gh-pfus merged 1 commit intomainfrom
pfus-03-26-no-snow_propagate_unrecognised_driver_parameters_as_session_parameters
Apr 1, 2026
Merged

NO-SNOW Propagate unrecognised driver parameters as session parameters#737
sfc-gh-pfus merged 1 commit intomainfrom
pfus-03-26-no-snow_propagate_unrecognised_driver_parameters_as_session_parameters

Conversation

@sfc-gh-pfus
Copy link
Copy Markdown
Collaborator

@sfc-gh-pfus sfc-gh-pfus commented Mar 26, 2026

TL;DR

Added functionality to forward unrecognized connection options as session parameters during login, allowing drivers to set arbitrary Snowflake session parameters like QUERY_TAG through connection strings.

What changed?

  • Modified sf_core to collect unrecognized string-typed connection settings and forward them as session parameters during login
  • Updated ODBC driver to forward unknown connection string keys to sf_core instead of logging warnings
  • Added collect_unknown_settings() function to identify and collect unregistered connection options
  • Added iter() method to ParamStore to enable iteration over stored settings
  • Explicit session parameters take precedence over forwarded connection options when both are present

How to test?

Run the new end-to-end tests across all drivers:

  • Set QUERY_TAG=session_param_e2e_test as a connection option
  • Execute SELECT CURRENT_QUERY_TAG()
  • Verify the result returns "session_param_e2e_test"

Tests are available for JDBC, ODBC, Python, and sf_core, along with a shared Gherkin feature definition.

Why make this change?

This enables drivers to support arbitrary Snowflake session parameters without requiring explicit implementation for each parameter. Users can now set session parameters like QUERY_TAG, TIMEZONE, or any other Snowflake session parameter directly through connection options, improving flexibility and reducing the need for driver-specific parameter support.

Copilot AI review requested due to automatic review settings March 26, 2026 18:36
Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enables drivers to pass arbitrary Snowflake session parameters by supplying unrecognized connection options, which sf_core forwards as session parameters during the login request. It also adds end-to-end coverage across the shared .feature definition and the Rust/Python/JDBC/ODBC driver test suites.

Changes:

  • Add sf_core logic to collect unregistered connection settings and forward them as login-time session parameters.
  • Update the ODBC wrapper to forward previously-ignored unknown connection string keys into sf_core.
  • Add cross-language E2E tests validating QUERY_TAG forwarding behavior.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/definitions/shared/session/session_parameters.feature Adds shared behavioral definition for session-parameter forwarding via connection options.
sf_core/tests/e2e/session/session_parameters.rs Adds Rust E2E test verifying QUERY_TAG is applied via unknown connection option.
sf_core/tests/e2e/session/mod.rs Wires the new Rust E2E session test module.
sf_core/src/config/param_store.rs Exposes an iterator over stored parameters for internal use.
sf_core/src/apis/database_driver_v1/validation.rs Implements collect_unknown_settings + unit test to identify and forward unknown settings.
sf_core/src/apis/database_driver_v1/connection.rs Merges unknown settings into init_session_parameters before login.
python/tests/e2e/session/test_session_parameters.py Adds Python E2E test (skipped for reference driver) for unknown option forwarding.
odbc_tests/tests/e2e/session/session_parameters.cpp Adds ODBC E2E test verifying QUERY_TAG forwarding via connection string.
odbc_tests/tests/e2e/CMakeLists.txt Registers the new ODBC E2E test target.
odbc/src/api/connection.rs Forwards unrecognized connection string keys to sf_core instead of ignoring them.
jdbc/src/test/java/net/snowflake/jdbc/e2e/session/SessionParametersTests.java Adds JDBC E2E test verifying QUERY_TAG forwarding via connection properties.

Comment thread sf_core/src/apis/database_driver_v1/validation.rs
Comment thread sf_core/src/apis/database_driver_v1/connection.rs
Comment thread sf_core/src/apis/database_driver_v1/validation.rs Outdated
@sfc-gh-pfus sfc-gh-pfus force-pushed the pfus-03-26-no-snow_propagate_unrecognised_driver_parameters_as_session_parameters branch from 8841a75 to d9f37ad Compare March 27, 2026 09:19
@sfc-gh-pfus sfc-gh-pfus marked this pull request as ready for review March 27, 2026 10:06
@sfc-gh-pfus sfc-gh-pfus requested a review from a team as a code owner March 27, 2026 10:06
Copilot AI review requested due to automatic review settings March 27, 2026 10:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.

Comment thread sf_core/src/apis/database_driver_v1/connection.rs Outdated
Comment thread python/tests/e2e/session/test_session_parameters.py Outdated
Copy link
Copy Markdown
Collaborator

@sfc-gh-boler sfc-gh-boler left a comment

Choose a reason for hiding this comment

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

lgtm, but see the two commends from Copilot, which should be addressed.

@sfc-gh-pfus sfc-gh-pfus force-pushed the pfus-03-26-no-snow_propagate_unrecognised_driver_parameters_as_session_parameters branch from d9f37ad to 171027a Compare March 30, 2026 12:59
@sfc-gh-pfus sfc-gh-pfus added this pull request to the merge queue Apr 1, 2026
Merged via the queue into main with commit f577dff Apr 1, 2026
79 of 84 checks passed
@sfc-gh-pfus sfc-gh-pfus deleted the pfus-03-26-no-snow_propagate_unrecognised_driver_parameters_as_session_parameters branch April 1, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants