From caffe3cb1f971519d29268ad136bb07abe6b59f9 Mon Sep 17 00:00:00 2001 From: John Bodley <4567245+john-bodley@users.noreply.github.com> Date: Fri, 28 Jul 2023 13:54:18 -0700 Subject: [PATCH] fix(migration): Ensure cascadeParentIds key exists (#24831) --- ...9_16-48_a23c6f8b1280_cleanup_erroneous_parent_filter_ids.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/superset/migrations/versions/2023-07-19_16-48_a23c6f8b1280_cleanup_erroneous_parent_filter_ids.py b/superset/migrations/versions/2023-07-19_16-48_a23c6f8b1280_cleanup_erroneous_parent_filter_ids.py index 17ad592b22..f5bdb29a96 100644 --- a/superset/migrations/versions/2023-07-19_16-48_a23c6f8b1280_cleanup_erroneous_parent_filter_ids.py +++ b/superset/migrations/versions/2023-07-19_16-48_a23c6f8b1280_cleanup_erroneous_parent_filter_ids.py @@ -61,14 +61,13 @@ def upgrade(): filter_ids = {fltr["id"] for fltr in filters} for fltr in filters: - for parent_id in fltr["cascadeParentIds"][:]: + for parent_id in fltr.get("cascadeParentIds", [])[:]: if parent_id not in filter_ids: fltr["cascadeParentIds"].remove(parent_id) updated = True if updated: dashboard.json_metadata = json.dumps(json_metadata) - except Exception: logging.exception( f"Unable to parse JSON metadata for dashboard {dashboard.id}"