From 06f6a8a34d6db90737997c853302aaca12d57dbd Mon Sep 17 00:00:00 2001 From: Pat Nadolny Date: Fri, 25 Oct 2024 11:06:25 -0400 Subject: [PATCH] fix: URL-encode password value (#282) Closes https://github.com/MeltanoLabs/target-snowflake/issues/281 Sqlalchemy needs the url to be encoded as described in https://github.com/snowflakedb/snowflake-sqlalchemy?tab=readme-ov-file#escaping-special-characters-such-as---signs-in-passwords. This alters the default behavior to encode passwords. --- target_snowflake/connector.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target_snowflake/connector.py b/target_snowflake/connector.py index 9662e2c..398d835 100644 --- a/target_snowflake/connector.py +++ b/target_snowflake/connector.py @@ -1,5 +1,6 @@ from __future__ import annotations +import urllib.parse from enum import Enum from functools import cached_property from operator import contains, eq @@ -194,7 +195,7 @@ def get_sqlalchemy_url(self, config: dict) -> str: if self.auth_method == SnowflakeAuthMethod.BROWSER: params["authenticator"] = "externalbrowser" elif self.auth_method == SnowflakeAuthMethod.PASSWORD: - params["password"] = config["password"] + params["password"] = urllib.parse.quote(config["password"]) for option in ["warehouse", "role"]: if config.get(option):