-
Notifications
You must be signed in to change notification settings - Fork 127
Add support for configurable catalog/schema for dashboards #4130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pietern
merged 11 commits into
databricks:main
from
leonli33-databricks:default-catalog-schema
Dec 18, 2025
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c1d4050
[DASH] Enable dashboard dataset_catalog/schema in direct deployment mode
leonli33-databricks c465f89
respond to feedback + failing tests
leonli33-databricks 22391a8
grammar
leonli33-databricks a49a0ee
Merge remote-tracking branch 'origin/main' into default-catalog-schema
pietern 3f8b827
Extend dataset_catalog and dataset_schema support to Terraform engine
pietern e546144
Fix
pietern a0d52e4
Update schema
pietern 7d5b7dd
Update dashboard dataset acceptance test output
pietern 2e743dc
Test the catalog/schema override e2e
pietern 473c096
Include CHANGELOG entry
pietern ca21bfe
Fix
pietern File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
acceptance/bundle/resources/dashboards/dataset-catalog-schema/databricks.yml.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # | ||
| # Acceptance test for deploying dashboards with dataset_catalog and dataset_schema. | ||
| # These fields override the catalog/schema for all datasets in the dashboard. | ||
| # | ||
| bundle: | ||
| name: deploy-dashboard-dataset-test-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| dashboards: | ||
| dashboard1: | ||
| display_name: $DASHBOARD_DISPLAY_NAME | ||
| warehouse_id: $TEST_DEFAULT_WAREHOUSE_ID | ||
| embed_credentials: true | ||
| dataset_catalog: main | ||
| dataset_schema: default | ||
| file_path: "sample-dashboard.lvdash.json" | ||
| parent_path: /Users/$CURRENT_USER_NAME |
45 changes: 45 additions & 0 deletions
45
acceptance/bundle/resources/dashboards/dataset-catalog-schema/out.plan.direct.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| { | ||
| "plan_version": 1, | ||
| "cli_version": "[DEV_VERSION]", | ||
| "plan": { | ||
| "resources.dashboards.dashboard1": { | ||
| "action": "skip", | ||
| "remote_state": { | ||
| "create_time": "[TIMESTAMP]", | ||
| "dashboard_id": "[DASHBOARD_ID]", | ||
| "display_name": "test bundle-deploy-dashboard-dataset [UUID]", | ||
| "embed_credentials": true, | ||
| "etag": [ETAG], | ||
| "lifecycle_state": "ACTIVE", | ||
| "parent_path": "/Workspace/Users/[USERNAME]", | ||
| "path": "/Users/[USERNAME]/test bundle-deploy-dashboard-dataset [UUID].lvdash.json", | ||
| "serialized_dashboard": "[SERIALIZED_FIXTURE]", | ||
| "update_time": "[TIMESTAMP]", | ||
| "warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]" | ||
| }, | ||
| "changes": { | ||
| "local": { | ||
| "etag": { | ||
| "action": "skip", | ||
| "old": [ETAG] | ||
| } | ||
| }, | ||
| "remote": { | ||
| "dataset_catalog": { | ||
| "action": "skip", | ||
| "old": "main" | ||
| }, | ||
| "dataset_schema": { | ||
| "action": "skip", | ||
| "old": "default" | ||
| }, | ||
| "serialized_dashboard": { | ||
| "action": "skip", | ||
| "old": "[SERIALIZED_FIXTURE_OLD]", | ||
| "new": "[SERIALIZED_FIXTURE_NEW]" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
acceptance/bundle/resources/dashboards/dataset-catalog-schema/out.plan.terraform.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "plan_version": 1, | ||
| "cli_version": "[DEV_VERSION]", | ||
| "plan": { | ||
| "resources.dashboards.dashboard1": { | ||
| "action": "skip" | ||
| } | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
acceptance/bundle/resources/dashboards/dataset-catalog-schema/out.post.requests.direct.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/lakeview/dashboards", | ||
| "q": { | ||
| "dataset_catalog": "main", | ||
| "dataset_schema": "default" | ||
| }, | ||
| "body": { | ||
| "display_name": "test bundle-deploy-dashboard-dataset [UUID]", | ||
| "parent_path": "/Workspace/Users/[USERNAME]", | ||
| "serialized_dashboard": "{\n \"pages\": [\n {\n \"name\": \"test_page\",\n \"displayName\": \"Test Page\",\n \"pageType\": \"PAGE_TYPE_CANVAS\"\n }\n ],\n \"datasets\": [\n {\n \"name\": \"bf8f76f4\",\n \"displayName\": \"Test Dataset\",\n \"queryLines\": [\n \"SELECT 1\\n\"\n ],\n \"catalog\": \"foobar\",\n \"schema\": \"foobar\"\n }\n ]\n}\n", | ||
| "warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]" | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
...ptance/bundle/resources/dashboards/dataset-catalog-schema/out.post.requests.terraform.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/lakeview/dashboards", | ||
| "q": { | ||
| "dataset_catalog": "main", | ||
| "dataset_schema": "default" | ||
| }, | ||
| "body": { | ||
| "display_name": "test bundle-deploy-dashboard-dataset [UUID]", | ||
| "parent_path": "/Workspace/Users/[USERNAME]", | ||
| "serialized_dashboard": "{\n \"pages\": [\n {\n \"name\": \"test_page\",\n \"displayName\": \"Test Page\",\n \"pageType\": \"PAGE_TYPE_CANVAS\"\n }\n ],\n \"datasets\": [\n {\n \"name\": \"bf8f76f4\",\n \"displayName\": \"Test Dataset\",\n \"queryLines\": [\n \"SELECT 1\\n\"\n ],\n \"catalog\": \"foobar\",\n \"schema\": \"foobar\"\n }\n ]\n}\n", | ||
| "warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]" | ||
| } | ||
| } |
7 changes: 7 additions & 0 deletions
7
acceptance/bundle/resources/dashboards/dataset-catalog-schema/out.test.toml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
acceptance/bundle/resources/dashboards/dataset-catalog-schema/output.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-dashboard-dataset-test-[UNIQUE_NAME]/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| >>> [CLI] lakeview get [DASHBOARD_ID] | ||
| { | ||
| "lifecycle_state": "ACTIVE", | ||
| "parent_path": "/Users/[USERNAME]", | ||
| "path": "/Users/[USERNAME]/test bundle-deploy-dashboard-dataset [UUID].lvdash.json" | ||
| } | ||
|
|
||
| >>> [CLI] lakeview get [DASHBOARD_ID] | ||
| { | ||
| "catalog": "main", | ||
| "schema": "default" | ||
| } | ||
|
|
||
| >>> [CLI] bundle plan -o json | ||
|
|
||
| >>> [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.dashboards.dashboard1 | ||
|
|
||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/deploy-dashboard-dataset-test-[UNIQUE_NAME]/default | ||
|
|
||
| Deleting files... | ||
| Destroy complete! |
20 changes: 20 additions & 0 deletions
20
acceptance/bundle/resources/dashboards/dataset-catalog-schema/sample-dashboard.lvdash.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "pages": [ | ||
| { | ||
| "name": "test_page", | ||
| "displayName": "Test Page", | ||
| "pageType": "PAGE_TYPE_CANVAS" | ||
| } | ||
| ], | ||
| "datasets": [ | ||
| { | ||
| "name": "bf8f76f4", | ||
| "displayName": "Test Dataset", | ||
| "queryLines": [ | ||
| "SELECT 1\n" | ||
| ], | ||
| "catalog": "foobar", | ||
| "schema": "foobar" | ||
| } | ||
| ] | ||
| } |
49 changes: 49 additions & 0 deletions
49
acceptance/bundle/resources/dashboards/dataset-catalog-schema/script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #!/bin/bash | ||
| DASHBOARD_DISPLAY_NAME="test bundle-deploy-dashboard-dataset $(uuid)" | ||
| if [ -z "$CLOUD_ENV" ]; then | ||
| export TEST_DEFAULT_WAREHOUSE_ID="warehouse-1234" | ||
| echo "warehouse-1234:TEST_DEFAULT_WAREHOUSE_ID" >> ACC_REPLS | ||
| fi | ||
|
|
||
| export DASHBOARD_DISPLAY_NAME | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
|
|
||
| cleanup() { | ||
| trace $CLI bundle destroy --auto-approve | ||
| rm -f out.requests.txt | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| trace $CLI bundle deploy | ||
| DASHBOARD_ID=$($CLI bundle summary --output json | jq -r '.resources.dashboards.dashboard1.id') | ||
|
|
||
| # Capture the dashboard ID as a replacement. | ||
| echo "$DASHBOARD_ID:DASHBOARD_ID" >> ACC_REPLS | ||
|
|
||
| trace $CLI lakeview get $DASHBOARD_ID | jq '{lifecycle_state, parent_path, path}' | ||
|
|
||
| # Verify that the serialized_dashboard datasets have the overridden catalog/schema values. | ||
| # The dataset_catalog and dataset_schema parameters should override the values in the datasets. | ||
| trace $CLI lakeview get $DASHBOARD_ID | jq '.serialized_dashboard | fromjson | .datasets[] | {catalog, schema}' | ||
|
|
||
| # Verify that there is no drift right after deploy. | ||
| trace $CLI bundle plan -o json > out.plan.$DATABRICKS_BUNDLE_ENGINE.json | ||
|
|
||
| # Modify the direct plan to replace "serialized_dashboard" with a fixture. | ||
| # It is normalized on the backend so we cannot compare reliably across local and cloud. | ||
| if [ "$DATABRICKS_BUNDLE_ENGINE" = "direct" ]; then | ||
| jq '.plan["resources.dashboards.dashboard1"].remote_state.serialized_dashboard |= | ||
| if . then "[SERIALIZED_FIXTURE]" else . end' \ | ||
| out.plan.direct.json > out.plan.direct.json.tmp && mv out.plan.direct.json.tmp out.plan.direct.json | ||
| jq '.plan["resources.dashboards.dashboard1"].changes.remote.serialized_dashboard |= | ||
| if . then {"action": .action, "old": "[SERIALIZED_FIXTURE_OLD]", "new": "[SERIALIZED_FIXTURE_NEW]"} else . end' \ | ||
| out.plan.direct.json > out.plan.direct.json.tmp && mv out.plan.direct.json.tmp out.plan.direct.json | ||
| fi | ||
|
|
||
| # Print API requests made to create the dashboard. | ||
| # This verifies that dataset_catalog and dataset_schema are passed to the API. | ||
| cat out.requests.txt | \ | ||
| jq 'select(.method == "POST")' | \ | ||
| jq 'select(.path | contains("/api/2.0/lakeview/dashboards"))' | \ | ||
| jq 'select(.path | contains("/published") | not)' \ | ||
| > out.post.requests.$DATABRICKS_BUNDLE_ENGINE.txt |
12 changes: 12 additions & 0 deletions
12
acceptance/bundle/resources/dashboards/dataset-catalog-schema/test.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| Local = true | ||
| Cloud = true | ||
| RequiresWarehouse = true | ||
| RecordRequests = true | ||
| EnvVaryOutput = "DATABRICKS_BUNDLE_ENGINE" | ||
|
|
||
| [EnvMatrix] | ||
| DATABRICKS_BUNDLE_ENGINE = ["direct", "terraform"] | ||
|
|
||
| Ignore = [ | ||
| "databricks.yml", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.