diff --git a/src/databricks/labs/lsql/dashboards.py b/src/databricks/labs/lsql/dashboards.py index 091f00bf..3222ed5b 100644 --- a/src/databricks/labs/lsql/dashboards.py +++ b/src/databricks/labs/lsql/dashboards.py @@ -1133,9 +1133,9 @@ def create_dashboard( warehouse_id=warehouse_id, ) if dashboard_id is not None: - sdk_dashboard = self._ws.lakeview.update(dashboard_id, dashboard=dashboard_to_create.as_dict()) # type: ignore + sdk_dashboard = self._ws.lakeview.update(dashboard_id, dashboard=dashboard_to_create) else: - sdk_dashboard = self._ws.lakeview.create(dashboard=dashboard_to_create.as_dict()) # type: ignore + sdk_dashboard = self._ws.lakeview.create(dashboard=dashboard_to_create) if publish: assert sdk_dashboard.dashboard_id is not None self._ws.lakeview.publish(sdk_dashboard.dashboard_id, warehouse_id=warehouse_id) diff --git a/tests/integration/test_dashboards.py b/tests/integration/test_dashboards.py index f2eae100..4fbdf867 100644 --- a/tests/integration/test_dashboards.py +++ b/tests/integration/test_dashboards.py @@ -58,7 +58,7 @@ def create(*, display_name: str = "") -> SDKDashboard: display_name = f"created_by_lsql_{make_random()}" else: display_name = f"{display_name} ({make_random()})" - dashboard = ws.lakeview.create(dashboard=SDKDashboard(display_name=display_name).as_dict()) + dashboard = ws.lakeview.create(dashboard=SDKDashboard(display_name=display_name)) if is_in_debug(): dashboard_url = f"{ws.config.host}/sql/dashboardsv3/{dashboard.dashboard_id}" webbrowser.open(dashboard_url) @@ -117,7 +117,7 @@ def test_dashboards_creates_exported_dashboard_definition(ws, make_dashboard) -> dashboard_content = (Path(__file__).parent / "dashboards" / "dashboard.lvdash.json").read_text() dashboard_to_create = dataclasses.replace(sdk_dashboard, serialized_dashboard=dashboard_content) - ws.lakeview.update(sdk_dashboard.dashboard_id, dashboard=dashboard_to_create.as_dict()) + ws.lakeview.update(sdk_dashboard.dashboard_id, dashboard=dashboard_to_create) lakeview_dashboard = Dashboard.from_dict(json.loads(dashboard_content)) new_dashboard = dashboards.get_dashboard(sdk_dashboard.path)