Skip to content

go/adbc/driver/snowflake: option for session parameters #2539

Open
@frbvianna

Description

@frbvianna

What feature or improvement would you like to see?

If using adbc.OptionKeyURI to provide the DSN, multiple session parameters can be specified:
https://arrow.apache.org/adbc/current/driver/snowflake.html#uri-format

However, the DSN option is only compatible to user/password authentication (snowflake.OptionValueAuthSnowflake) since it is ensured by calling gosnowflake.ParseDSN to necessarily contain both of these fields. In a scenario where the user requires other types of authentication that do not rely on passwords (e.g. private key), if they wish to specify session parameters, they would have to construct a DSN with "mocked" password values, and additionally provide the account, in order to successfully specify the parameters in URI query format. Then, use the options to provide the correct authentication.
Otherwise, the user sends ALTER SESSION SET to set all parameters.

Instead, the driver could accept session parameters as a new option e.g. adbc.snowflake.sql.session_parameters expecting an encoded URI query segment. For instance:

sessionParams := url.Values{
	"param1": {"value1"},
	"param2": {"value2"},
}

db, err := drv.NewDatabase(map[string]string{
	"snowflake.OptionSessionParameters": sessionParams.Encode(),
})

Then the driver can decode these values using url.ParseQuery and send the ALTER SESSION statement to set all session parameters, which saves the effort for the user.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions