mirror of https://github.com/apache/superset.git
fix(migration): Ensure cascadeParentIds key exists (#24831)
This commit is contained in:
parent
64ced60f62
commit
caffe3cb1f
|
@ -61,14 +61,13 @@ def upgrade():
|
||||||
filter_ids = {fltr["id"] for fltr in filters}
|
filter_ids = {fltr["id"] for fltr in filters}
|
||||||
|
|
||||||
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:
|
if parent_id not in filter_ids:
|
||||||
fltr["cascadeParentIds"].remove(parent_id)
|
fltr["cascadeParentIds"].remove(parent_id)
|
||||||
updated = True
|
updated = True
|
||||||
|
|
||||||
if updated:
|
if updated:
|
||||||
dashboard.json_metadata = json.dumps(json_metadata)
|
dashboard.json_metadata = json.dumps(json_metadata)
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.exception(
|
logging.exception(
|
||||||
f"Unable to parse JSON metadata for dashboard {dashboard.id}"
|
f"Unable to parse JSON metadata for dashboard {dashboard.id}"
|
||||||
|
|
Loading…
Reference in New Issue