Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion acceptance/bundle/generate/dashboard-inplace/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Deployment complete!
"path":"/Users/[USERNAME]/.bundle/dashboard update inplace/default/resources/test dashboard.lvdash.json",
"serialized_dashboard":"{\"a\":\"b\"}\n",
"update_time":"[TIMESTAMP]",
"warehouse_id":"my-warehouse-1234"
"warehouse_id":""
}

=== update the dashboard file using bundle generate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"method": "PATCH",
"path": "/api/2.0/lakeview/dashboards/[DASHBOARD_ID]",
"body": {
"serialized_dashboard": "{}"
"serialized_dashboard": "{}",
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
}
}
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"method": "PATCH",
"path": "/api/2.0/lakeview/dashboards/[DASHBOARD_ID]",
"body": {
"serialized_dashboard": "{}"
"serialized_dashboard": "{}",
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
}
}
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $CLI lakeview get "${DASHBOARD_ID}" | jq '{display_name,page_display_name: (.ser

title "Make an out of band modification to the dashboard and confirm that it is detected:\n"
RESOURCE_ID=$($CLI workspace get-status "${DASHBOARD_PATH}" | jq -r '.resource_id')
DASHBOARD_JSON='{"serialized_dashboard": "{}"}'
DASHBOARD_JSON="{\"serialized_dashboard\": \"{}\", \"warehouse_id\": \"$TEST_DEFAULT_WAREHOUSE_ID\"}"
$CLI lakeview update "${RESOURCE_ID}" --json "${DASHBOARD_JSON}" | jq '{lifecycle_state}'

title "Try to redeploy the bundle and confirm that the out of band modification is detected:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Deployment complete!
"{\n \"uiSettings\": {\n \"theme\": {\n \"widgetHeaderAlignment\": \"ALIGNMENT_UNSPECIFIED\"\n }\n }\n}\n"

=== Update dashboard
"{}\n"
"{\n \"uiSettings\": {\n \"theme\": {\n \"widgetHeaderAlignment\": \"ALIGNMENT_UNSPECIFIED\"\n }\n }\n}\n"

>>> [CLI] bundle generate dashboard --resource already_exists
Error: dashboard.lvdash.json already exists. Use --force to overwrite
Expand All @@ -30,7 +30,13 @@ Exit code: 1
Writing dashboard to dashboard.lvdash.json

>>> cat dashboard.lvdash.json
{}
{
"uiSettings": {
"theme": {
"widgetHeaderAlignment": "ALIGNMENT_UNSPECIFIED"
}
}
}

>>> [CLI] bundle destroy --auto-approve
The following resources will be deleted:
Expand Down
10 changes: 8 additions & 2 deletions integration/assumptions/dashboard_assumptions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ func TestDashboardAssumptions_WorkspaceImport(t *testing.T) {
current, err := convert.FromTyped(currentDashboard, dyn.NilValue)
require.NoError(t, err)

// Collect updated paths.
// Collect updated and deleted paths.
var updatedFieldPaths []string
var deletedFieldPaths []string
_, err = merge.Override(previous, current, merge.OverrideVisitor{
VisitDelete: func(basePath dyn.Path, left dyn.Value) error {
assert.Fail(t, "unexpected delete operation")
deletedFieldPaths = append(deletedFieldPaths, basePath.String())
return nil
},
VisitInsert: func(basePath dyn.Path, right dyn.Value) (dyn.Value, error) {
Expand All @@ -111,5 +112,10 @@ func TestDashboardAssumptions_WorkspaceImport(t *testing.T) {
"etag",
"update_time",
}, updatedFieldPaths)

// The warehouse_id field is cleared after workspace import.
assert.ElementsMatch(t, []string{
"warehouse_id",
}, deletedFieldPaths)
}
}
4 changes: 1 addition & 3 deletions libs/testserver/dashboards.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,7 @@ func (s *FakeWorkspace) DashboardUpdate(req Request) Response {
datasetSchema := req.URL.Query().Get("dataset_schema")
dashboard.SerializedDashboard = transformSerializedDashboard(updateReq.SerializedDashboard, datasetCatalog, datasetSchema)
}
if updateReq.WarehouseId != "" {
dashboard.WarehouseId = updateReq.WarehouseId
}
dashboard.WarehouseId = updateReq.WarehouseId
Copy link
Copy Markdown
Contributor

@anton-107 anton-107 Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update dashboard API is using the PATCH semantics (see https://docs.databricks.com/api/workspace/lakeview/update). If the field is missing from the request the previous values should be left intact.

The generate/dashboard-inplace was failing in the original commit because of this, but I could not find: which local test was failing prior to this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't have an update_mask field to select which fields to update though.

This testserver change aligns the local test with the remote observed behavior.

dashboard.UpdateTime = time.Now().UTC().Format(time.RFC3339)

s.Dashboards[dashboardId] = dashboard
Expand Down