@@ -124,19 +124,15 @@ def __init__(
124
124
f'"{ self .registry_config .database } "."{ self .registry_config .schema_ } "'
125
125
)
126
126
127
- if not self ._verify_registry_database ():
128
- # Verify the existing resitry database schema from snowflake. If any table names and column types is wrong, run table recreation SQL.
129
- with GetSnowflakeConnection (self .registry_config ) as conn :
130
- sql_function_file = f"{ os .path .dirname (feast .__file__ )} /infra/utils/snowflake/registry/snowflake_table_creation.sql"
131
- with open (sql_function_file , "r" ) as file :
132
- sqlFile = file .read ()
133
-
134
- sqlCommands = sqlFile .split (";" )
135
- for command in sqlCommands :
136
- query = command .replace (
137
- "REGISTRY_PATH" , f"{ self .registry_path } "
138
- )
139
- execute_snowflake_statement (conn , query )
127
+ with GetSnowflakeConnection (self .registry_config ) as conn :
128
+ sql_function_file = f"{ os .path .dirname (feast .__file__ )} /infra/utils/snowflake/registry/snowflake_table_creation.sql"
129
+ with open (sql_function_file , "r" ) as file :
130
+ sqlFile = file .read ()
131
+
132
+ sqlCommands = sqlFile .split (";" )
133
+ for command in sqlCommands :
134
+ query = command .replace ("REGISTRY_PATH" , f"{ self .registry_path } " )
135
+ execute_snowflake_statement (conn , query )
140
136
141
137
self .cached_registry_proto = self .proto ()
142
138
proto_registry_utils .init_project_metadata (self .cached_registry_proto , project )
@@ -149,55 +145,6 @@ def __init__(
149
145
)
150
146
self .project = project
151
147
152
- def _verify_registry_database (
153
- self ,
154
- ) -> bool :
155
- """Verify the records in registry database. To check:
156
- 1, the 11 tables are existed.
157
- 2, the column types are correct.
158
-
159
- Example return from snowflake's cursor.describe("SELECT * FROM a_table") command:
160
- [ResultMetadata(name='ENTITY_NAME', type_code=2, display_size=None, internal_size=16777216, precision=None, scale=None, is_nullable=False),
161
- ResultMetadata(name='PROJECT_ID', type_code=2, display_size=None, internal_size=16777216, precision=None, scale=None, is_nullable=False),
162
- ResultMetadata(name='LAST_UPDATED_TIMESTAMP', type_code=6, display_size=None, internal_size=None, precision=0, scale=9, is_nullable=False),
163
- ResultMetadata(name='ENTITY_PROTO', type_code=11, display_size=None, internal_size=8388608, precision=None, scale=None, is_nullable=False)]
164
-
165
- Returns:
166
- True if the necessary 11 tables are existed in Snowflake and schema of each table is correct.
167
- False if failure happens.
168
- """
169
-
170
- from feast .infra .utils .snowflake .registry .snowflake_registry_table import (
171
- snowflake_registry_table_names_and_column_types as expect_tables ,
172
- )
173
-
174
- res = True
175
-
176
- try :
177
- with GetSnowflakeConnection (self .registry_config ) as conn :
178
- for table_name in expect_tables :
179
- result_metadata_list = conn .cursor ().describe (
180
- f"SELECT * FROM { table_name } "
181
- )
182
- for col in result_metadata_list :
183
- if (
184
- expect_tables [table_name ][col .name ]["type_code" ]
185
- != col .type_code
186
- ):
187
- res = False
188
- break
189
- except Exception as e :
190
- res = False # Set to False for all errors.
191
- logger .debug (
192
- f"Failed to verify Registry tables and columns types with exception: { e } ."
193
- )
194
- finally :
195
- # The implementation in snowflake_utils.py will cache the established connection without re-connection logic.
196
- # conn.close()
197
- pass
198
-
199
- return res
200
-
201
148
def refresh (self , project : Optional [str ] = None ):
202
149
if project :
203
150
project_metadata = proto_registry_utils .get_project_metadata (
0 commit comments