lightdash download
From the Lightdash CLI, you can use the command lightdash download to download all of the charts and dashboards from your Lightdash project as code. All of the charts and dashboards will be written as .yml files to a lightdash directory wherever you’re running the command.
E.g. if you’re running this command inside your dbt directory (eg: /home/javi/dbt) then it will create a folder (/home/javi/dbt/lightdash). If you’re running this command in /home/javi/documents it will create the folder in /home/javi/documents/lightdash.

Running lightdash download will overwrite any changes you have locally
For example:
- I run lightdash downloadand one of the charts that is downloaded isemea-revenue-per-month.yml
- I make some changes to the emea-revenue-per-month.ymlfile and save them
- I do not upload my changes, they are just saved locally
- I run lightdash downloadagain
- The changes I made to emea-revenue-per-month.ymlwill be overwritten by the latest chart version downloaded from the Lightdash application
Select specific items to download
Use lightdash download -c or lightdash download --charts to select specific charts
If you only want to download specific charts to manage as code, you can use the chart selector in the download command.
For example, if I only wanted to download a specific saved chart as code, I would run the command:
Use lightdash download -d or lightdash download --dashboards to select specific dashboards
This will download the dashboard and all of the charts in the dashboard as code. For example, if I only wanted to download a specific dashboard as code, I would run the command:
To select multiple charts or dashboards, add a space between the items.
For example, this command would select two charts to download:Specify a download path
Uselightdash download -p or lightdash download --path to specify a directory to download to
By default, lightdash download will create a new lightdash directory in your current working directory and write the content there. You can customize the directory that you write to using lightdash download -p. For example:
/Users/katiehindson/lightdash/lightdash-analytics/charts/ and /Users/katiehindson/lightdash/lightdash-analytics/dashboards and save the content to these new folders.
You can also use relative paths like:
Download an entire project
Uselightdash download --project <project UUID> to download all content from a specific project
Running lightdash download will download all content from your current set project (set using lightdash config set-project). But, you can download content from another project using lightdash download --project my-project-uuid. For example:
https://app.lightdash.cloud/projects/123-project-uuid/. Here, the project UUID here is 123-project-uuid .
lightdash upload
lightdash upload updates any content as code to your project.
From the Lightdash CLI, you can use the command lightdash upload to upload any changes you’ve made to your charts or dashboards as code. To upload new charts that you’ve created as code to your Lightdash project, you need to run lightdash upload --force
Select specific items to upload
Use lightdash upload -c or lightdash upload --charts to select specific charts
For example, if I only wanted to upload a specific saved chart as code, I would run the command:
Use lightdash upload -d or lightdash upload --dashboards to select specific dashboards
For example, if I only wanted to upload a specific dashboard as code, I would run the command:
Use --include-charts to upload chart changes when uploading dashboards
When uploading specific dashboards using -d, you can also include any chart changes referenced by those dashboards by adding the --include-charts flag:
To select multiple charts or dashboards, add a space between the items
For example, this command would select two charts to upload:Specify a path to upload from.
Uselightdash upload -p or lightdash upload --path to specify a directory to upload from.
By default, lightdash upload will upload all items you have saved in the lightdash directory in your current working directory. You can customize the directory that you upload from using lightdash upload -p. For example:
/Users/katiehindson/lightdash/lightdash-analytics/charts/ and /Users/katiehindson/lightdash/lightdash-analytics/dashboards.
You can also use relative paths like:
Specify a project to upload to
Uselightdash upload --project <project UUID> to upload your content to a specific project.
Running lightdash upload will upload all content to your current set project (set using lightdash config set-project). But, you can upload content to another project using lightdash upload --project my-project-uuid. For example:
https://app.lightdash.cloud/projects/123-project-uuid/. Here, the project UUID here is 123-project-uuid .
Only content as code that you’ve made changes to will be uploaded
For example:- I have a chart that I’ve downloaded as code called total-sales-worldwide.ymlin mylightdash/directory
- I only make changes to that chart’s .yml
- I run lightdash upload
- total-sales-worldwide.ymlis the only file that gets uploaded because it’s the only file that I made changes to
- Katie has a chart that she’s downloaded as code called total-sales-worldwide.ymlin herlightdash/directory
- She doesn’t make any changes to the chart as code
- Javi opens the same chart, Total sales worldwide, in the Lightdash application, makes some changes, and saves them
- Now, Katie’s total-sales-worldwide.ymland theTotal sales worldwidechart in the application are different.
- Katie runs lightdash upload
- Katie’s total-sales-worldwide.ymldoes not get uploaded because she made no changes to the chart as code
- Javi’s changes to the Total sales worldwidechart that he made in the Lightdash application are not overwritten (the version he created is what we see in the Lightdash application)
Content that’s been downloaded as code can still be updated in the Lightdash application
For example:- There is a Lightdash project called Stellar Marketing
- Priyanka runs lightdash downloadand downloads all of the project’s content as code, including a chart calledTotal new clients
- Jake opens the Total new clientschart in the Lightdash application and makes some changes
- Priyanka doesn’t run lightdash download, so thetotal-new-clients.ymlchart that Priyanka has as code is the old version of the chart, before Jake updated it.
- Priyanka makes changes to total-new-clients.ymlthen runslightdash uploadand uploads her changes and overwrites the changes that Jake made in the Lightdash application.
- Both Jake and Priyanka can update the same chart as code, or in the Lightdash application.
Lightdash content templates
You can use thelightdash download and lightdash upload commands to easily build templates for Lightdash content and reuse these templates to build new or update existing projects.
Creating a new Lightdash project from a Lightdash template
If you’re creating many dbt projects with similar models and want to easily spin up new versions of these projects, but with different table, field, or chart names, then you can use content as code to create a Lightdash template of your project to reuse. To do this, you’ll need to:- Take your existing Lightdash project with all of the content that you want to copy.
- In the CLI, run lightdash downloadto download all of the content as code from the project
- Navigate to your new dbt project that you want to connect to Lightdash.
- Copy-paste over the lightdash/directory inside your new dbt project with all of the content as code from your template project (or, only copy over the content that you want to use in your new project)
- Once you’re happy with your content, you’re going to run lightdash config set-projectand select your new Lightdash project from the list of projects
- Then, you’ll run lightdash upload --forceto upload all of the content as code you’ve added in yourlightdash/directory to your new Lightdash project
Adding content to an existing project from a Lightdash template
Sometimes, if you’re managing multiple dbt projects with similar models, you want to be able to easily create and manage the same charts and dashboards across all of the projects at the same time. You can do this with content as code to create a Lightdash template project.- You want to create a Lightdash project that only contains all of the content that you want to share across your projects
- From your CLI, you can run lightdash downloadto download all of this content as code
- You can then copy-paste the .yml files that get written across to any of the other dbt projects you have where you want to reuse the same charts and dashboards.
- Once you’ve copied over any content that you wanted to manage across projects, from the CLI, you should run lightdash config set-projectand select the project where you’ve added these new charts/dashboards as code to.
- Then, you should run lightdash uploadto upload all of the new content as code.
Using community templates
Alongside making templates from your own project, you can also use templates from the lightdash-templates repo to quickly build dashboards on top of common datasets. For example, if you are using BigQuery as your data warehouse, you can use the community templates to build a usage tracking dashboard in a matter of minutes. There are detailed instructions within the repo, but the general steps are as follows:- Identify the content you wish to implement, and navigate to the relevant folder.
- Copy the content from the Lightdashfolder into your dbt project.
- Run lightdash upload --forceto push your new content to Lightdash.
Dashboard as code yml reference
The yml configuration for dashboards as code is extensive. It covers both dashboards and individual charts. The best way to start is often to create your content in the Lightdash UI, download it, and in most cases the structure will be fairly intuitive. Below are outlines of the structures you will find for both types of content to provide some additional context. The examples below are not exhaustive, so if you have additional questions, you can always reach out to our support team for more details. 
Dashboards
These are the simpler of the two content types. Alongside the standard information, such as the name, description, updated at, slug and space information, you’ll find details for each tile and the content that exists within it and detailed filter information. Here’s an example of a basic dashboard with three tiles and a couple of filters. We’ve added some comments for context!Dashboards as code example
Charts
Charts store a large amount of configuration, and so are more complex and more variable that what you will find within the dashboard yml files. Again, you will find basic information such as the name, description, updated at, slug and space information. But on top of that we also store all of the possible configuration you might have included in a chart. This includes things like:- Dimensions
- Metrics
- Custom Fields
- Table Calculations
- Filters
- Visualization Configuration
- Formatting
- Sorting

Charts as code example
JSON schema validation in VSCode
When building content as code in YAML format, you can enable JSON schema validation in VSCode to get autocomplete suggestions and validation. This helps you understand what properties are supported and ensures your YAML files are correctly formatted. To set this up:- Install the YAML extension for VSCode
- 
Open your VSCode user settings in JSON format (press Cmd/Ctrl + Shift + Pand search for “Preferences: Open User Settings (JSON)”)
- Add the following configuration:
VSCode settings.json
Make sure to update 
path_to_charts/charts/*.yml and path_to_dashboards/dashboards/*.yml to match the actual paths where your content as code files are stored (e.g., lightdash/charts/*.yml and lightdash/dashboards/*.yml).