Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View no tag fix #159

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions materializationengine/blueprints/client/api2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -1677,7 +1678,7 @@ def get(

@client_bp.expect(query_parser)
@client_bp.route(
"/datastack/<string:datastack_name>/version/<int(signed+True):version>/views/<string:view_name>/metadata"
"/datastack/<string:datastack_name>/version/<int(signed=True):version>/views/<string:view_name>/metadata"
)
class ViewMetadata(Resource):
method_decorators = [
Expand Down
Loading