You have a Look or dashboard that uses model A. You also have a second model, B. You want to change the model reference of the Look or dashboard to be model B instead.
There are multiple solutions, depending on the situation:
- For a single Look, edit the Look's expanded URL.
- For one or more dashboards, create a LookML copy.
- For multiple Looks or dashboards:
Edit the Look's Expanded URL
For a one-off Look, you can simply get the expanded URL for the Look's Explore and then edit the model name in the URL.
- From the Look, click the Explore from Here link to open the Look's query in an Explore.
- In the Explore, click the gear menu, and select Share.
- Copy the expanded URL.
- Change the model name in the expanded URL. The model name comes right after the instance name and the
/explorepart of the URL. The URL takes the following form:
In this example, the model name is
- Paste your new Explore URL in a browser and verify that it works with the updated model name.
- Save the Explore as a new Look, or overwrite your existing Look.
Create LookML Copies of Dashboards
For one or more dashboards, you can convert each dashboard to a LookML dashboard and update the dashboard's model in the LookML:
- For each dashboard, create a LookML copy of the dashboard and save it in your LookML project. (If your dashboards are already LookML dashboards, you can skip this step.)
- In your LookML project, use the Looker IDE's search and replace function to find instances of
model:, and then update the value to your new model name.
- You can leave the updated dashboards as LookML dashboards, or you can convert them to user-defined dashboards.
Use the Looker API
You can use the Looker API to update the model for multiple dashboards:
- Use the
dashboard_elementsAPI endpoint to get all the dashboard elements. The response will provide the query IDs.
- If any of the dashboard tiles are Look-linked tiles, use the
lookendpoint to find the query ID of the Look.
- For each of the query IDs:
- For the dashboard, change the query ID for each of the elements by using the
update_dashboard_elementendpoint, passing in the edited body.
Use the Looker Content Validator
The Content Validator is a tool that checks Looks and dashboards for errors, and it also has a Find & Replace in All Content feature, which you can use to change the underlying model or Explore for all Looks or dashboard tiles.
The Find & Replace in All Content feature changes all Looks and dashboards on the Looker instance. To apply this change to only a few Looks or dashboard tiles, you can make a breaking change, as described in the steps below.
If we don't want to change the model or Explore reference for all content across an instance, but do want to change the reference for more than one Look or dashboard tile at a time, we can leverage the Content Validator to replace the references for a handful of Looks or dashboard tiles all at once:
- In Development Mode, intentionally "break" the existing model by renaming the model file in the Looker IDE to another model name that you know does not exist, such as
zzz. This will cause every Look and dashboard that uses that model to break. However, the Looks and dashboards will be broken only in Development Mode, so no other users will be affected.
- Under the Develop menu, open the Content Validator.
- Click Validate to run the Content Validator.
- In the Content Validator results, click the Content button to group the results by content.
- Find the Looks or dashboard tiles that you want to update to use a different model.
- For each Look or dashboard, you can then click the Replace button to replace the "broken" model name with the new model name you want to use.
- Check that the Looks or dashboard tiles work as expected now that they point to the new model.
- Finally, go back to the Looker IDE and rename the model file back to its original name, then run the Content Validator again to verify all validation errors are cleared.