You can download your charts and dashboards as code, make changes, then upload your changes back to your Lightdash project using the CLI. Content as code is also useful for creating new Lightdash projects where you want the content to be copied from an existing project and added to your new project.
lightdash download
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
.
lightdash download
will overwrite any changes you have locallylightdash download
and one of the charts that is downloaded is emea-revenue-per-month.yml
emea-revenue-per-month.yml
file and save themlightdash download
againemea-revenue-per-month.yml
will be overwritten by the latest chart version downloaded from the Lightdash applicationlightdash download -c
or lightdash download --charts
to select specific chartslightdash download -d
or lightdash download --dashboards
to select specific dashboardslightdash 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:
lightdash 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
lightdash upload -c
or lightdash upload --charts
to select specific chartslightdash upload -d
or lightdash upload --dashboards
to select specific dashboardslightdash 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:
lightdash 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
.
total-sales-worldwide.yml
in my lightdash/
directorylightdash upload
total-sales-worldwide.yml
is the only file that gets uploaded because it’s the only file that I made changes tototal-sales-worldwide.yml
in her lightdash/
directoryTotal sales worldwide
, in the Lightdash application, makes some changes, and saves themtotal-sales-worldwide.yml
and the Total sales worldwide
chart in the application are different.lightdash upload
total-sales-worldwide.yml
does not get uploaded because she made no changes to the chart as codeTotal sales worldwide
chart that he made in the Lightdash application are not overwritten (the version he created is what we see in the Lightdash application)Stellar Marketing
lightdash download
and downloads all of the project’s content as code, including a chart called Total new clients
Total new clients
chart in the Lightdash application and makes some changeslightdash download
, so the total-new-clients.yml
chart that Priyanka has as code is the old version of the chart, before Jake updated it.total-new-clients.yml
then runs lightdash upload
and uploads her changes and overwrites the changes that Jake made in the Lightdash application.lightdash download
and lightdash upload
commands to easily build templates for Lightdash content and reuse these templates to build new or update existing projects.
lightdash download
to download all of the content as code from the projectlightdash/
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)lightdash config set-project
and select your new Lightdash project from the list of projectslightdash upload --force
to upload all of the content as code you’ve added in your lightdash/
directory to your new Lightdash projectlightdash download
to download all of this content as codelightdash config set-project
and select the project where you’ve added these new charts/dashboards as code to.lightdash upload
to upload all of the new content as code.Lightdash
folder into your dbt project.lightdash upload --force
to push your new content to Lightdash.