Repository: feast-dev/feast

Issue:
Snowflake login support private key or web browser authentication
The current snowflake support seems only allow password authentication but we are using Azure AD login without password for the account.
Can we add functionality to allow different mechanism of authentication?


Discussion:
@realLyans thanks for this feature request! cc @sfc-gh-madkins who's been working on Snowflake - do you think this could be supported easily?
From what I can see backend is not very hard - just need to change https://github.com/feast-dev/feast/blob/f2bc4119b44fd35ea6739118273cfa48aa243cbe/sdk/python/feast/infra/utils/snowflake_utils.py to add different method of authentication; main question is design of front end which I am not very familiar with.
by frontend do you mean what the ideal API is in defining the SnowflakeSource? I think it'd probably be a new field and then we enforce with some validation check in the constructor that the user has only one form of authentication specified.
@adchia meaning the CLI interface that sets up the repo which doesn't really allow configuration there and I am also not too sure how I should enter a private key if it being a long binary typed variable. I don't think SnowflakeSource need a change (I might be wrong).
@felixwang9817 @adchia @realLyans -- the snowflake integration for feast relies on the snowflake-connector-python ... any authentication method available for that package is available to feast users. The current design is for your project .yaml file to override any values set in a config file that by defaults points at where you config lives if you download the snowflake CLI tool ... if you want to define your own config file ... simple provide the path in the project .yaml file

Where the enhancement needs to happen is that the snowflake connection method should accept kwargs ... which it currently doesnt

Resolving patch:
diff --git a/sdk/python/feast/infra/utils/snowflake_utils.py b/sdk/python/feast/infra/utils/snowflake_utils.py
--- a/sdk/python/feast/infra/utils/snowflake_utils.py
+++ b/sdk/python/feast/infra/utils/snowflake_utils.py
@@ -43,29 +43,27 @@ def get_snowflake_conn(config, autocommit=True) -> SnowflakeConnection:
     if config.type == "snowflake.offline":
         config_header = "connections.feast_offline_store"
 
-    config = dict(config)
+    config_dict = dict(config)
 
     # read config file
     config_reader = configparser.ConfigParser()
-    config_reader.read([config["config_path"]])
+    config_reader.read([config_dict["config_path"]])
     if config_reader.has_section(config_header):
         kwargs = dict(config_reader[config_header])
     else:
         kwargs = {}
 
-    kwargs.update((k, v) for k, v in config.items() if v is not None)
+    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_")
 
     try:
         conn = snowflake.connector.connect(
-            account=kwargs["account"],
-            user=kwargs["user"],
-            password=kwargs["password"],
-            role=f'''"{kwargs['role']}"''',
-            warehouse=f'''"{kwargs['warehouse']}"''',
-            database=f'''"{kwargs['database']}"''',
-            schema=f'''"{kwargs['schema_']}"''',
-            application="feast",
-            autocommit=autocommit,
+            application="feast", autocommit=autocommit, **kwargs
         )
 
         return conn


Test patch: