snowflakedb / gosnowflake

Go Snowflake Driver
Apache License 2.0
292 stars 122 forks source link

SNOW-1524204 handle session variables in DSN #1177

Closed sfc-gh-dszmolka closed 2 months ago

sfc-gh-dszmolka commented 2 months ago

Session variables (https://docs.snowflake.com/en/sql-reference/session-variables) must be specified as $variablename=value .

Currently due to their urlencoding, they end up being sent as %24variablename=value to the server side, which in turn won't recognize it as a session variable and won't use it.

Fix attempts to introduce a urldecoding function to those custom Params which are session variables to be actually sent as valid session variable format. Besides the unit test, fix was manually tested to confirm session variables are sent correctly, and a subsequent SHOW VARIABLES; query in the same session actually shows the variable.

edit: since then, an end-to-end test has been also added; which actually connects to an account, and verifies if the session variables are matching what is sent

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Project coverage is 83.01%. Comparing base (9730225) to head (a8177ca).

Files Patch % Lines
dsn.go 71.42% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1177 +/- ## ========================================== - Coverage 83.02% 83.01% -0.01% ========================================== Files 54 54 Lines 12653 12659 +6 ========================================== + Hits 10505 10509 +4 - Misses 2148 2150 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.