cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

docs.databricks.com

Valentin1
New Contributor III

Is there an any example that contains at least one widget that works with the Databricks SQL Create Dashboard API? I tried the following simple dashboard:

{
    "name": "Delta View",
    "dashboard_filters_enabled": false,
    "widgets": [
        {
            "width": 1,
            "options": {
                "isHidden": false,
                "position": {
                    "autoHeight": false,
                    "sizeX": 3,
                    "sizeY": 3,
                    "minSizeX": 1,
                    "maxSizeX": 6,
                    "minSizeY": 1,
                    "maxSizeY": 1000,
                    "col": 0,
                    "row": 0
                }
            },
            "text": "21221"
        }
    ],
    "is_draft": false,
    "tags": []
}

and no widgets are actually created/added to the dashboard. The output looks like this:

    {
        "id": "89b2fb34-1647-4ae1-94a8-692cf6293eec",
        "slug": "delta-view",
        "name": "Delta View",
        "user_id": <redacted>,
        "data_source_id": null,
        "dashboard_filters_enabled": false,
        "widgets": null,
        "options": {
            "refresh_schedules": []
        },
        "is_draft": false,
        "tags": [],
        "updated_at": "2022-08-08T13:22:43Z",
        "created_at": "2022-08-08T13:22:43Z",
        "version": 1,
        "user": {
            "id": <redacted>,
            "name": "<redacted>",
            "email": "<redacted>",
            "profile_image_url": "<redacted>",
            "is_db_admin": false
        },
        "refresh_schedules": [],
        "color_palette": null,
        "run_as_role": null,
        "run_as_service_principal_id": null,
        "is_favorite": false,
        "is_archived": false
    }

It can be observed that the "widgets" field becomes null even for this simple example. The Databricks API documentation (https://docs.databricks.com/sql/api/queries-dashboards.html) says that widgets are possible but no good example is given, just the one where the widgets field is an empty array.

I understand that this is a public preview and not all the things might work as expected, but this seem to us as a huge letdown as we cannot deploy our dashboards to other environments unless we manually recreate them each time there is a change.

We would like to automatically deploy our dashboards from one environment to another but for now there doesn't seem to be any way we can do this. We would appreciate your help with this issue. Thank you!

3 REPLIES 3

Debayan
Esteemed Contributor III

@Valentin Rosca​ There is an API to create new dashboard object but also it is not recommended by Databricks as it is mentioned "Databricks does not recommend designing dashboards exclusively using this API." Please refer below:

https://docs.databricks.com/sql/api/queries-dashboards.html#operation/sql-analytics-create-dashboard

Also, The widgets field on a dashboard is read-only. As of now, we cannot design new widgets and create them with the API as it is not supported.

Valentin1
New Contributor III

Thank you for your answer! We understand that it's not usable as of now.

Out of curiosity, if the widgets are not designed to be specified via the API why is that field available as an input in the API? It's just confusing now as changing it does not yield any different result. Would it be available in the future as a proper input? Because presently you can only create empty dashboards via the API.

Also, is there an automated way that allows us to copy a dashboard from one Databricks workspace to another? (from Dev to Qa for example) If not, are there any plans to make this available in the future?

Thank you!

Debayan
Esteemed Contributor III

@Valentin Rosca​ , Right now, Databricks also does not recommend creating new widgets via queries and dashboards API (https://docs.databricks.com/sql/api/queries-dashboards.html#operation/sql-analytics-create-dashboard).

image 

Also, copying a dashboard from one workspace to another would be a forthcoming feature.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group