From 2320a2be167080999cb0a209650be9772275c581 Mon Sep 17 00:00:00 2001 From: Chester Ong Date: Mon, 11 Mar 2024 13:39:04 +0800 Subject: [PATCH 1/2] increase snowflake-connector-python to 3.7 Signed-off-by: Chester Ong --- sdk/python/feast/infra/offline_stores/snowflake.py | 13 +------------ setup.py | 2 +- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/sdk/python/feast/infra/offline_stores/snowflake.py b/sdk/python/feast/infra/offline_stores/snowflake.py index 14752fd857..fa7596c51a 100644 --- a/sdk/python/feast/infra/offline_stores/snowflake.py +++ b/sdk/python/feast/infra/offline_stores/snowflake.py @@ -470,21 +470,10 @@ def _to_df_internal(self, timeout: Optional[int] = None) -> pd.DataFrame: return df def _to_arrow_internal(self, timeout: Optional[int] = None) -> pyarrow.Table: - pa_table = execute_snowflake_statement( + return execute_snowflake_statement( self.snowflake_conn, self.to_sql() ).fetch_arrow_all(force_return_table=False) - if pa_table: - return pa_table - else: - empty_result = execute_snowflake_statement( - self.snowflake_conn, self.to_sql() - ) - - return pyarrow.Table.from_pandas( - pd.DataFrame(columns=[md.name for md in empty_result.description]) - ) - def to_sql(self) -> str: """ Returns the SQL query that will be executed in Snowflake to build the historical feature table. diff --git a/setup.py b/setup.py index b601c90146..0459cbd6eb 100644 --- a/setup.py +++ b/setup.py @@ -96,7 +96,7 @@ BYTEWAX_REQUIRED = ["bytewax==0.15.1", "docker>=5.0.2", "kubernetes<=20.13.0"] SNOWFLAKE_REQUIRED = [ - "snowflake-connector-python[pandas]>=3,<4", + "snowflake-connector-python[pandas]>=3.7,<4", ] SPARK_REQUIRED = [ From f619773ab9e1d6c7257c4761e7436c57430c207b Mon Sep 17 00:00:00 2001 From: Chester Ong Date: Mon, 11 Mar 2024 13:50:29 +0800 Subject: [PATCH 2/2] force_return_table to True Signed-off-by: Chester Ong --- sdk/python/feast/infra/offline_stores/snowflake.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/python/feast/infra/offline_stores/snowflake.py b/sdk/python/feast/infra/offline_stores/snowflake.py index fa7596c51a..cfaca038e7 100644 --- a/sdk/python/feast/infra/offline_stores/snowflake.py +++ b/sdk/python/feast/infra/offline_stores/snowflake.py @@ -472,7 +472,7 @@ def _to_df_internal(self, timeout: Optional[int] = None) -> pd.DataFrame: def _to_arrow_internal(self, timeout: Optional[int] = None) -> pyarrow.Table: return execute_snowflake_statement( self.snowflake_conn, self.to_sql() - ).fetch_arrow_all(force_return_table=False) + ).fetch_arrow_all(force_return_table=True) def to_sql(self) -> str: """