28
28
from feast .infra .registry import proto_registry_utils
29
29
from feast .infra .registry .base_registry import BaseRegistry
30
30
from feast .infra .utils .snowflake .snowflake_utils import (
31
+ GetSnowflakeConnection ,
31
32
execute_snowflake_statement ,
32
- get_snowflake_conn ,
33
33
)
34
34
from feast .on_demand_feature_view import OnDemandFeatureView
35
35
from feast .project_metadata import ProjectMetadata
@@ -121,7 +121,7 @@ def __init__(
121
121
f'"{ self .registry_config .database } "."{ self .registry_config .schema_ } "'
122
122
)
123
123
124
- with get_snowflake_conn (self .registry_config ) as conn :
124
+ with GetSnowflakeConnection (self .registry_config ) as conn :
125
125
sql_function_file = f"{ os .path .dirname (feast .__file__ )} /infra/utils/snowflake/registry/snowflake_table_creation.sql"
126
126
with open (sql_function_file , "r" ) as file :
127
127
sqlFile = file .read ()
@@ -177,7 +177,7 @@ def _refresh_cached_registry_if_necessary(self):
177
177
self .refresh ()
178
178
179
179
def teardown (self ):
180
- with get_snowflake_conn (self .registry_config ) as conn :
180
+ with GetSnowflakeConnection (self .registry_config ) as conn :
181
181
sql_function_file = f"{ os .path .dirname (feast .__file__ )} /infra/utils/snowflake/registry/snowflake_table_deletion.sql"
182
182
with open (sql_function_file , "r" ) as file :
183
183
sqlFile = file .read ()
@@ -284,7 +284,7 @@ def _apply_object(
284
284
if hasattr (obj , "last_updated_timestamp" ):
285
285
obj .last_updated_timestamp = update_datetime
286
286
287
- with get_snowflake_conn (self .registry_config ) as conn :
287
+ with GetSnowflakeConnection (self .registry_config ) as conn :
288
288
query = f"""
289
289
SELECT
290
290
project_id
@@ -405,7 +405,7 @@ def _delete_object(
405
405
id_field_name : str ,
406
406
not_found_exception : Optional [Callable ],
407
407
):
408
- with get_snowflake_conn (self .registry_config ) as conn :
408
+ with GetSnowflakeConnection (self .registry_config ) as conn :
409
409
query = f"""
410
410
DELETE FROM { self .registry_path } ."{ table } "
411
411
WHERE
@@ -616,7 +616,7 @@ def _get_object(
616
616
not_found_exception : Optional [Callable ],
617
617
):
618
618
self ._maybe_init_project_metadata (project )
619
- with get_snowflake_conn (self .registry_config ) as conn :
619
+ with GetSnowflakeConnection (self .registry_config ) as conn :
620
620
query = f"""
621
621
SELECT
622
622
{ proto_field_name }
@@ -776,7 +776,7 @@ def _list_objects(
776
776
proto_field_name : str ,
777
777
):
778
778
self ._maybe_init_project_metadata (project )
779
- with get_snowflake_conn (self .registry_config ) as conn :
779
+ with GetSnowflakeConnection (self .registry_config ) as conn :
780
780
query = f"""
781
781
SELECT
782
782
{ proto_field_name }
@@ -839,7 +839,7 @@ def list_project_metadata(
839
839
return proto_registry_utils .list_project_metadata (
840
840
self .cached_registry_proto , project
841
841
)
842
- with get_snowflake_conn (self .registry_config ) as conn :
842
+ with GetSnowflakeConnection (self .registry_config ) as conn :
843
843
query = f"""
844
844
SELECT
845
845
metadata_key,
@@ -869,7 +869,7 @@ def apply_user_metadata(
869
869
):
870
870
fv_table_str = self ._infer_fv_table (feature_view )
871
871
fv_column_name = fv_table_str [:- 1 ].lower ()
872
- with get_snowflake_conn (self .registry_config ) as conn :
872
+ with GetSnowflakeConnection (self .registry_config ) as conn :
873
873
query = f"""
874
874
SELECT
875
875
project_id
@@ -905,7 +905,7 @@ def get_user_metadata(
905
905
) -> Optional [bytes ]:
906
906
fv_table_str = self ._infer_fv_table (feature_view )
907
907
fv_column_name = fv_table_str [:- 1 ].lower ()
908
- with get_snowflake_conn (self .registry_config ) as conn :
908
+ with GetSnowflakeConnection (self .registry_config ) as conn :
909
909
query = f"""
910
910
SELECT
911
911
user_metadata
@@ -971,7 +971,7 @@ def _get_all_projects(self) -> Set[str]:
971
971
"STREAM_FEATURE_VIEWS" ,
972
972
]
973
973
974
- with get_snowflake_conn (self .registry_config ) as conn :
974
+ with GetSnowflakeConnection (self .registry_config ) as conn :
975
975
for table in base_tables :
976
976
query = (
977
977
f'SELECT DISTINCT project_id FROM { self .registry_path } ."{ table } "'
@@ -984,7 +984,7 @@ def _get_all_projects(self) -> Set[str]:
984
984
return projects
985
985
986
986
def _get_last_updated_metadata (self , project : str ):
987
- with get_snowflake_conn (self .registry_config ) as conn :
987
+ with GetSnowflakeConnection (self .registry_config ) as conn :
988
988
query = f"""
989
989
SELECT
990
990
metadata_value
@@ -1029,7 +1029,7 @@ def _infer_fv_table(self, feature_view) -> str:
1029
1029
return table
1030
1030
1031
1031
def _maybe_init_project_metadata (self , project ):
1032
- with get_snowflake_conn (self .registry_config ) as conn :
1032
+ with GetSnowflakeConnection (self .registry_config ) as conn :
1033
1033
query = f"""
1034
1034
SELECT
1035
1035
metadata_value
@@ -1056,7 +1056,7 @@ def _maybe_init_project_metadata(self, project):
1056
1056
usage .set_current_project_uuid (new_project_uuid )
1057
1057
1058
1058
def _set_last_updated_metadata (self , last_updated : datetime , project : str ):
1059
- with get_snowflake_conn (self .registry_config ) as conn :
1059
+ with GetSnowflakeConnection (self .registry_config ) as conn :
1060
1060
query = f"""
1061
1061
SELECT
1062
1062
project_id
0 commit comments