From 226f078f62562fbc3b72633983cef3f0d9a2cd86 Mon Sep 17 00:00:00 2001 From: Lars George <136075433+larsgeorge-db@users.noreply.github.com> Date: Fri, 27 Oct 2023 20:35:40 +0200 Subject: [PATCH] Fixed handling of keys with and without values. (#514) Fixes #491 --- src/databricks/labs/ucx/framework/dashboards.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/databricks/labs/ucx/framework/dashboards.py b/src/databricks/labs/ucx/framework/dashboards.py index 2df82c0769..c08ebeb2ae 100644 --- a/src/databricks/labs/ucx/framework/dashboards.py +++ b/src/databricks/labs/ucx/framework/dashboards.py @@ -175,10 +175,9 @@ def _installed_query_state(self): self._state = json.load(self._ws.workspace.download(self._query_state)) to_remove = [] for k, v in self._state.items(): - _, name = k.split(":") - if k == "dashboard_id": + if k.endswith("dashboard_id"): continue - if name != "query_id": + if not k.endswith("query_id"): continue try: self._ws.queries.get(v) @@ -215,7 +214,7 @@ def _store_query_state(self, queries: dict[str, list[SimpleQuery]]): if k in desired_keys: new_state[k] = v continue - _, name = k.split(":") + name = k if ":" not in k else k.split(":")[-1] if name not in destructors: continue try: