Last tested: Aug 12, 2022
You may find yourself in a situation where you want to make changes to a LookML Dashboard, and have those changes be reflected in an existing User Defined Dashboard. This is possible via the API:
lookml_link_id
in the response body, this is what we want to update.Insert the LookML Dashboard ID (the part with the :: in the LookML Dashboard url) into the earlier part of the response body from step 1 to update just the lookml_link_id
parameter and run {lookml_link_id="thelook::users"
{"lookml_link_id": "thelook::users"}
This content is subject to limited support.
Hi all, here is the example snippet using Looker Python SDK for this use case.
The following script will link a LookML dashboard (`thelook::users`) with a user-defined dashboard (UDD) id=1, abbreviated as dashboard, and then update the dashboard to reflect the LookML dashboard.
import looker_sdk
import os
# Auth in using the `os` module. Alternatively, use an `.ini` file
os.environ['LOOKERSDK_BASE_URL'] = 'url'
os.environ['LOOKERSDK_CLIENT_ID'] = 'foo'
os.environ['LOOKERSDK_CLIENT_SECRET'] = 'bar'
sdk = looker_sdk.init40()
# Link a LookML dashboard with a dashboard by updating `lookml_link_id`. To get the value for `lookml_link_id`, look at the URL of your LookML dashboard. Example: https://my-instance.com/dashboards-next/thelook::users then `thelook::users` would be the ID of this LookML dashboard
from looker_sdk.sdk.api40.models import WriteDashboard
sdk.update_dashboard(dashboard_id="1",body=WriteDashboard(
lookml_link_id="thelook::users"
))
# Sync the LookML dashboard with the dashboard (the dashboard will reflect what is currently defined in the LookML dashboard)
lookml = sdk.sync_lookml_dashboard(lookml_dashboard_id="thelook::users",body=WriteDashboard())
print(lookml) # expecting a list containing ids of all dashboards that have been linked to this LookML dashboard, in this example, expecting id 1