File tree Expand file tree Collapse file tree 4 files changed +24
-7
lines changed
Expand file tree Collapse file tree 4 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -243,6 +243,13 @@ def __init__(self, details):
243243 super ().__init__ (f"Redshift SQL Query failed to finish. Details: { details } " )
244244
245245
246+ class RedshiftTableNameTooLong (Exception ):
247+ def __init__ (self , table_name : str ):
248+ super ().__init__ (
249+ f"Redshift table names have a maximum length of 127 characters, but the table name { table_name } has length { len (table_name )} characters."
250+ )
251+
252+
246253class EntityTimestampInferenceException (Exception ):
247254 def __init__ (self , expected_column_name : str ):
248255 super ().__init__ (
Original file line number Diff line number Diff line change 1515 wait_exponential ,
1616)
1717
18- from feast .errors import RedshiftCredentialsError , RedshiftQueryError
18+ from feast .errors import (
19+ RedshiftCredentialsError ,
20+ RedshiftQueryError ,
21+ RedshiftTableNameTooLong ,
22+ )
1923from feast .type_map import pa_to_redshift_value_type
2024
2125try :
2832 raise FeastExtrasDependencyImportError ("aws" , str (e ))
2933
3034
35+ REDSHIFT_TABLE_NAME_MAX_LENGTH = 127
36+
37+
3138def get_redshift_data_client (aws_region : str ):
3239 """
3340 Get the Redshift Data API Service client for the given AWS region.
@@ -184,7 +191,7 @@ def upload_df_to_redshift(
184191 iam_role : str ,
185192 table_name : str ,
186193 df : pd .DataFrame ,
187- ) -> None :
194+ ):
188195 """Uploads a Pandas DataFrame to Redshift as a new table.
189196
190197 The caller is responsible for deleting the table when no longer necessary.
@@ -208,9 +215,12 @@ def upload_df_to_redshift(
208215 table_name: The name of the new Redshift table where we copy the dataframe
209216 df: The Pandas DataFrame to upload
210217
211- Returns: None
212-
218+ Raises:
219+ RedshiftTableNameTooLong: The specified table name is too long.
213220 """
221+ if len (table_name ) > REDSHIFT_TABLE_NAME_MAX_LENGTH :
222+ raise RedshiftTableNameTooLong (table_name )
223+
214224 bucket , key = get_bucket_and_key (s3_path )
215225
216226 # Drop the index so that we dont have unnecessary columns
Original file line number Diff line number Diff line change @@ -258,7 +258,7 @@ def construct_test_environment(
258258 worker_id : str = "worker_id" ,
259259) -> Environment :
260260
261- _uuid = str (uuid .uuid4 ()).replace ("-" , "" )[:8 ]
261+ _uuid = str (uuid .uuid4 ()).replace ("-" , "" )[:6 ]
262262
263263 run_id = os .getenv ("GITHUB_RUN_ID" , default = None )
264264 run_id = f"gh_run_{ run_id } _{ _uuid } " if run_id else _uuid
Original file line number Diff line number Diff line change @@ -174,10 +174,10 @@ def test_nullable_online_store(test_nullable_online_store) -> None:
174174
175175 with tempfile .TemporaryDirectory () as repo_dir_name :
176176 try :
177+ repo_path = Path (repo_dir_name )
177178 feature_store_yaml = make_feature_store_yaml (
178- project , test_nullable_online_store , repo_dir_name
179+ project , test_nullable_online_store , repo_path
179180 )
180- repo_path = Path (repo_dir_name )
181181
182182 repo_config = repo_path / "feature_store.yaml"
183183
You can’t perform that action at this time.
0 commit comments