Skip to content

Commit 8245267

Browse files
Allow all snowflake python connector connection methods to be available to feast
Signed-off-by: Miles Adkins <miles.adkins@snowflake.com>
1 parent 1ba86fb commit 8245267

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

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

+5-10
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,24 @@ 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+
[kwargs.update({k: '"'+v+'"'}) for k,v in kwargs.items() if k in ['role', 'warehouse', 'database', 'schema_']]
5758

5859
try:
5960
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_']}"''',
6761
application="feast",
6862
autocommit=autocommit,
63+
**kwargs
6964
)
7065

7166
return conn

0 commit comments

Comments
 (0)