Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fixed bug in passing config file params to snowflake python connector #2503

Merged
merged 3 commits into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
18 changes: 12 additions & 6 deletions sdk/python/feast/infra/utils/snowflake_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,19 @@ def get_snowflake_conn(config, autocommit=True) -> SnowflakeConnection:
else:
kwargs = {}

if "schema" in kwargs:
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_")

for k, v in kwargs.items():
if k in ["role", "warehouse", "database", "schema_"]:
kwargs[k] = f'"{v}"'

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

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