Skip to content

Commit d7d9d78

Browse files
sfc-gh-madkinsachals
authored andcommitted
feat: Allow all snowflake python connector connection methods to be available to Feast (feast-dev#2356)
* Allow all snowflake python connector connection methods to be available to feast Signed-off-by: Miles Adkins <miles.adkins@snowflake.com> * format/lint Signed-off-by: Miles Adkins <miles.adkins@snowflake.com> * feat: have feast using snowflake python connector for authentication Signed-off-by: Miles Adkins <miles.adkins@snowflake.com> * fix random print Signed-off-by: Miles Adkins <miles.adkins@snowflake.com> Signed-off-by: Achal Shah <achals@gmail.com>
1 parent a15e947 commit d7d9d78

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

sdk/python/feast/infra/utils/snowflake_utils.py

+10-12
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,27 @@ def get_snowflake_conn(config, autocommit=True) -> SnowflakeConnection:
4343
if config.type == "snowflake.offline":
4444
config_header = "connections.feast_offline_store"
4545

46-
config = dict(config)
46+
config_dict = dict(config)
4747

4848
# read config file
4949
config_reader = configparser.ConfigParser()
50-
config_reader.read([config["config_path"]])
50+
config_reader.read([config_dict["config_path"]])
5151
if config_reader.has_section(config_header):
5252
kwargs = dict(config_reader[config_header])
5353
else:
5454
kwargs = {}
5555

56-
kwargs.update((k, v) for k, v in config.items() if v is not None)
56+
kwargs.update((k, v) for k, v in config_dict.items() if v is not None)
57+
[
58+
kwargs.update({k: '"' + v + '"'})
59+
for k, v in kwargs.items()
60+
if k in ["role", "warehouse", "database", "schema_"]
61+
]
62+
kwargs["schema"] = kwargs.pop("schema_")
5763

5864
try:
5965
conn = snowflake.connector.connect(
60-
account=kwargs["account"],
61-
user=kwargs["user"],
62-
password=kwargs["password"],
63-
role=f'''"{kwargs['role']}"''',
64-
warehouse=f'''"{kwargs['warehouse']}"''',
65-
database=f'''"{kwargs['database']}"''',
66-
schema=f'''"{kwargs['schema_']}"''',
67-
application="feast",
68-
autocommit=autocommit,
66+
application="feast", autocommit=autocommit, **kwargs
6967
)
7068

7169
return conn

0 commit comments

Comments
 (0)