Today we’re launching Dashboards as Code, a new way to manage your dashboards using YAML. This opens up new exciting workflows that would be impossible or impractical to implement using only the UI.
Once a BI project reaches hundreds of dashboards, it becomes very difficult to govern and maintain consistency. Making changes like renaming metrics or tables, or duplicating content at scale becomes really hard because making repetitive changes through the UI is slow and error-prone.
In Lightdash, you can now manage all your charts and dashboards as YAML files, in a git repository. You can even use your existing dbt repository, so you can store all your data models, transformations, and BI content in one place (as the data gods intended).
For data teams, this means your content is version-controlled giving a lot of options for rolling-back, disaster recovery, and governance. Even better, you can make bulk changes safely without repetitive UI tasks.
To get started, open your terminal and upgrade your Lightdash CLI. Then download all your content by using the download
command (available to admins only):
This will create a new folder for your content containing a YAML file for each chart and dashboard in your project. First you should check these files into git. You could do this in a new repository or in your existing dbt repository to keep your dashboard definitions right next to your dbt model and metric definitions.
Notice that each chart and dashboard has a slug which is a unique identifier for the resource. If you want to change a chart or a dashboard you should keep this slug consistent.
Let's say we want to make a change to a chart, we can manipulate the YAML. For example, here I'll update the chart from a line chart to a bar chart:
Once you've made your changes you can re-upload the specific chart by using the upload command:
Here we used -c to sub-select a specific chart. You can read more information on selectors in our docs. This covers the basics of how to download and upload your dashboards as code. Now let's see how we can combine these actions to build powerful code-based workflows.
A common BI refactoring task is when you've had to rename a table or metric in dbt. With Dashboards as Code you can now make these changes with one quick find-and -replace instead of using the Lightdash UI to manually find and update multiple charts.g
In the example below, I find a metric in my project and use my code editor's features to find all references to the metric and replace them. This was much faster and more reliable than doing it manually!
Kraken is an end-to-end platform for utilities. They manage over 60 million customer accounts, more than 50 GW of power, and over 300,000 consumer devices such as electric cars and charging stations.
At Kraken, one of the big challenges they faced using Lightdash was being able to create and manage a lot of Lightdash projects in a fast and error-resilient way. And for them, managing dashboards as code was a huge improvement to their workflow.
Kraken’s deployments work a bit like this:
With dashboards as code, Kraken has managed to create dbt + Lightdash packages that create the correct models and dashboards automatically, so managing Lightdash projects at scale is faster and easier than ever.
We think it’s pretty great, but here’s what Kraken has to say about it:
Lightdash’s dashboards-as-code approach is transforming how we manage analytics at Kraken. By integrating dashboard changes directly into our CI/CD pipeline, we’re achieving both lightning-fast deployments and bulletproof governance - solving two of our biggest BI challenges in one stroke. This has unlocked exciting new possibilities for our analytics teams across the business.
- Alex Edwards (Lead Data Analyst at Kraken)
Dashboards as Code is now available for everybody to use. To get started, read the full guide in our docs.
Haven't tried Lightdash before? Book a demo to start a trial!