w.dashboards: Dashboards

class databricks.sdk.service.sql.DashboardsAPI

In general, there is little need to modify dashboards using the API. However, it can be useful to use dashboard objects to look-up a collection of related query IDs. The API can also be used to duplicate multiple dashboards at once since you can get a dashboard definition with a GET request and then POST it to create a new one. Dashboards can be scheduled using the sql_task type of the Jobs API, e.g. :method:jobs/create.

create(name: str [, dashboard_filters_enabled: Optional[bool], is_favorite: Optional[bool], parent: Optional[str], run_as_role: Optional[RunAsRole], tags: Optional[List[str]]]) Dashboard

Usage:

import time

from databricks.sdk import WorkspaceClient

w = WorkspaceClient()

created = w.dashboards.create(name=f'sdk-{time.time_ns()}')

# cleanup
w.dashboards.delete(dashboard_id=created.id)

Create a dashboard object.

Parameters:
  • name – str The title of this dashboard that appears in list views and at the top of the dashboard page.

  • dashboard_filters_enabled – bool (optional) Indicates whether the dashboard filters are enabled

  • is_favorite – bool (optional) Indicates whether this dashboard object should appear in the current user’s favorites list.

  • parent – str (optional) The identifier of the workspace folder containing the object.

  • run_as_roleRunAsRole (optional) Sets the Run as role for the object. Must be set to one of “viewer” (signifying “run as viewer” behavior) or “owner” (signifying “run as owner” behavior)

  • tags – List[str] (optional)

Returns:

Dashboard

delete(dashboard_id: str)

Usage:

import time

from databricks.sdk import WorkspaceClient

w = WorkspaceClient()

created = w.dashboards.create(name=f'sdk-{time.time_ns()}')

w.dashboards.delete(dashboard_id=created.id)

# cleanup
w.dashboards.delete(dashboard_id=created.id)

Remove a dashboard.

Moves a dashboard to the trash. Trashed dashboards do not appear in list views or searches, and cannot be shared.

Parameters:

dashboard_id – str

get(dashboard_id: str) Dashboard

Usage:

import time

from databricks.sdk import WorkspaceClient

w = WorkspaceClient()

created = w.dashboards.create(name=f'sdk-{time.time_ns()}')

by_id = w.dashboards.get(dashboard_id=created.id)

# cleanup
w.dashboards.delete(dashboard_id=created.id)

Retrieve a definition.

Returns a JSON representation of a dashboard object, including its visualization and query objects.

Parameters:

dashboard_id – str

Returns:

Dashboard

list([, order: Optional[ListOrder], page: Optional[int], page_size: Optional[int], q: Optional[str]]) Iterator[Dashboard]

Usage:

from databricks.sdk import WorkspaceClient
from databricks.sdk.service import sql

w = WorkspaceClient()

all = w.dashboards.list(sql.ListDashboardsRequest())

Get dashboard objects.

Fetch a paginated list of dashboard objects.

### Warning: Calling this API concurrently 10 or more times could result in throttling, service degradation, or a temporary ban.

Parameters:
  • orderListOrder (optional) Name of dashboard attribute to order by.

  • page – int (optional) Page number to retrieve.

  • page_size – int (optional) Number of dashboards to return per page.

  • q – str (optional) Full text search term.

Returns:

Iterator over Dashboard

restore(dashboard_id: str)

Usage:

import time

from databricks.sdk import WorkspaceClient

w = WorkspaceClient()

created = w.dashboards.create(name=f'sdk-{time.time_ns()}')

w.dashboards.restore(dashboard_id=created.id)

# cleanup
w.dashboards.delete(dashboard_id=created.id)

Restore a dashboard.

A restored dashboard appears in list views and searches and can be shared.

Parameters:

dashboard_id – str

update(dashboard_id: str [, name: Optional[str], run_as_role: Optional[RunAsRole], tags: Optional[List[str]]]) Dashboard

Change a dashboard definition.

Modify this dashboard definition. This operation only affects attributes of the dashboard object. It does not add, modify, or remove widgets.

Note: You cannot undo this operation.

Parameters:
  • dashboard_id – str

  • name – str (optional) The title of this dashboard that appears in list views and at the top of the dashboard page.

  • run_as_roleRunAsRole (optional) Sets the Run as role for the object. Must be set to one of “viewer” (signifying “run as viewer” behavior) or “owner” (signifying “run as owner” behavior)

  • tags – List[str] (optional)

Returns:

Dashboard