Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
frbvianna opened this issue Feb 18, 2025 · 2 comments
Open

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

frbvianna opened this issue Feb 18, 2025 · 2 comments
Labels
Type: enhancement New feature or request

Comments

@frbvianna
Copy link

frbvianna commented Feb 18, 2025

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.

@frbvianna frbvianna added the Type: enhancement New feature or request label Feb 18, 2025
@zeroshade
Copy link
Member

so this would be the way to pass session parameters when you aren't using a URI at all? Am I understanding correctly?

@frbvianna
Copy link
Author

so this would be the way to pass session parameters when you aren't using a URI at all? Am I understanding correctly?

@zeroshade I think that is one way to put it.
At least from my testing, I could not set the URI to just the session parameters portion, so my understanding is that the only way to specify session parameters with the ADBC driver is to do the whole authentication with the DSN string, which does not seem possible for private key auth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants