Skip to content

Commit 34f2b59

Browse files
fix: Fixed bug in passing config file params to snowflake python connector (#2503)
* fixed bug in passing config file params to snowflake python connector Signed-off-by: Miles Adkins <[email protected]> * removed .keys() bug Signed-off-by: Miles Adkins <[email protected]> * fixed schema assignment error Signed-off-by: Miles Adkins <[email protected]>
1 parent 1279612 commit 34f2b59

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

sdk/python/feast/infra/offline_stores/snowflake.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class SnowflakeOfflineStoreConfig(FeastConfigBaseModel):
8282
database: Optional[str] = None
8383
""" Snowflake database name """
8484

85-
schema_: Optional[str] = Field("PUBLIC", alias="schema")
85+
schema_: Optional[str] = Field(None, alias="schema")
8686
""" Snowflake schema name """
8787

8888
class Config:

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,19 @@ def get_snowflake_conn(config, autocommit=True) -> SnowflakeConnection:
5353
else:
5454
kwargs = {}
5555

56+
if "schema" in kwargs:
57+
kwargs["schema_"] = kwargs.pop("schema")
58+
5659
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_")
60+
61+
for k, v in kwargs.items():
62+
if k in ["role", "warehouse", "database", "schema_"]:
63+
kwargs[k] = f'"{v}"'
64+
65+
if "schema_" in kwargs:
66+
kwargs["schema"] = kwargs.pop("schema_")
67+
else:
68+
kwargs["schema"] = '"PUBLIC"'
6369

6470
try:
6571
conn = snowflake.connector.connect(

0 commit comments

Comments
 (0)