Skip to content

Commit

Permalink
fixed bug in passing config file params to snowflake python connector
Browse files Browse the repository at this point in the history
Signed-off-by: Miles Adkins <[email protected]>
  • Loading branch information
sfc-gh-madkins committed Apr 6, 2022
1 parent e083458 commit 94295a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sdk/python/feast/infra/offline_stores/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class SnowflakeOfflineStoreConfig(FeastConfigBaseModel):
database: Optional[str] = None
""" Snowflake database name """

schema_: Optional[str] = Field("PUBLIC", alias="schema")
schema_: Optional[str] = Field(None, alias="schema")
""" Snowflake schema name """

class Config:
Expand Down
9 changes: 8 additions & 1 deletion sdk/python/feast/infra/utils/snowflake_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,20 @@ def get_snowflake_conn(config, autocommit=True) -> SnowflakeConnection:
else:
kwargs = {}

if "schema" in kwargs.keys():
kwargs["schema_"] = kwargs.pop("schema")

kwargs.update((k, v) for k, v in config_dict.items() if v is not None)
[
kwargs.update({k: '"' + v + '"'})
for k, v in kwargs.items()
if k in ["role", "warehouse", "database", "schema_"]
]
kwargs["schema"] = kwargs.pop("schema_")

if "schema" in kwargs.keys():
kwargs["schema"] = kwargs.pop("schema_")
else:
kwargs["schema"] = '"PUBLIC"'

try:
conn = snowflake.connector.connect(
Expand Down

0 comments on commit 94295a0

Please sign in to comment.