Skip to content

schemachange ignores session_parameters from connections.toml #350

@SiarheiBohdanPR

Description

@SiarheiBohdanPR

Describe the bug
schemachange ignores session_parameters defined in connections.toml.
In SnowflakeSession.py, schemachange constructs its own session_parameters = {"QUERY_TAG": ...} and passes that into snowflake.connector.connect(...), which overwrites any session_parameters from the TOML connection (e.g., QUOTED_IDENTIFIERS_IGNORE_CASE=false).
As a result, users cannot control session-level behavior via connections.toml.

To Reproduce

  1. Create a connections.toml with a named connection (matching --connection-name) that includes session_parameters:
    [STG]
    account = "xxx"
    user = "xxx"
    authenticator = "externalbrowser"
    role = "STG_ROLE"
    warehouse = "STG_WH"
    database = "DB_STG"
    schema = "ADM"
    
    session_parameters = { QUOTED_IDENTIFIERS_IGNORE_CASE = false }
  2. Run schemachange using that connection:
    schemachange --connections-file-path ./connections.toml --connection-name STG      --config-folder ./_INFRA/configs --config-file-name schemachange-config.yml
  3. During the same run (e.g., via a small script or interactive session), check the parameter:
    SHOW PARAMETERS LIKE 'QUOTED_IDENTIFIERS_IGNORE_CASE' IN SESSION;
    Actual: value remains TRUE (or the user/account default), not false from TOML.

Expected behavior
schemachange should respect session_parameters provided via connections.toml.
If schemachange needs to set QUERY_TAG, it should merge its tag into user-supplied session_parameters rather than overwrite them. Alternatively, avoid passing session_parameters to connect(...) and set QUERY_TAG post-connect via ALTER SESSION.

Screenshots

Image

Schemachange (please complete the following information):

  • Version (e.g., 3.5.3): 4.0.1

Additional context

  • Root cause: SnowflakeSession builds self.session_parameters = {"QUERY_TAG": ...} and passes it to snowflake.connector.connect(...), eclipsing TOML-defined session_parameters.

  • Proposed fixes:

    1. Merge TOML session_parameters with schemachange’s QUERY_TAG before connecting.
    2. Do not pass session_parameters at connect time; keep using ALTER SESSION SET QUERY_TAG so the connector can apply TOML session parameters as intended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions