From 6d2d819c4af6411288d91cb3e894b35d5ecd625e Mon Sep 17 00:00:00 2001 From: Forrest Collman Date: Sun, 25 Aug 2024 07:48:55 -0700 Subject: [PATCH 1/2] fix no tags case --- .../blueprints/client/api2.py | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/materializationengine/blueprints/client/api2.py b/materializationengine/blueprints/client/api2.py index 20524eea..42162d9e 100644 --- a/materializationengine/blueprints/client/api2.py +++ b/materializationengine/blueprints/client/api2.py @@ -1131,19 +1131,20 @@ def preprocess_view_dataframe(df, view_name, db_name, column_names): # remove nan values from unique values unique_vals[tag] = unique_vals[tag][~pd.isnull(unique_vals[tag])] - # find all the duplicate values across columns - vals, counts = np.unique( - np.concatenate([v for v in unique_vals.values()]), return_counts=True - ) - duplicates = vals[counts > 1] + if len(unique_vals) > 0: + # find all the duplicate values across columns + vals, counts = np.unique( + np.concatenate([v for v in unique_vals.values()]), return_counts=True + ) + duplicates = vals[counts > 1] - # iterate through the tags and replace any duplicate - # values in the dataframe with a unique value, - # based on preprending the column name - for tag in tags: - for dup in duplicates: - if dup in unique_vals[tag]: - df[tag] = df[tag].replace(dup, f"{tag}:{dup}") + # iterate through the tags and replace any duplicate + # values in the dataframe with a unique value, + # based on preprending the column name + for tag in tags: + for dup in duplicates: + if dup in unique_vals[tag]: + df[tag] = df[tag].replace(dup, f"{tag}:{dup}") return df, tags, bool_tags, numerical, root_id_col From bd0bae9b8552e5b9da5d67c34fca6df0dc295a1b Mon Sep 17 00:00:00 2001 From: Forrest Collman Date: Tue, 27 Aug 2024 06:27:53 -0700 Subject: [PATCH 2/2] bugfix on view metadata --- materializationengine/blueprints/client/api2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/materializationengine/blueprints/client/api2.py b/materializationengine/blueprints/client/api2.py index 42162d9e..68f226a2 100644 --- a/materializationengine/blueprints/client/api2.py +++ b/materializationengine/blueprints/client/api2.py @@ -1678,7 +1678,7 @@ def get( @client_bp.expect(query_parser) @client_bp.route( - "/datastack//version//views//metadata" + "/datastack//version//views//metadata" ) class ViewMetadata(Resource): method_decorators = [