The Lightdash CLI is the recommended way to develop your Lightdash project. It makes development faster and easier, as well as giving you options for building more powerful automation to manage your Lightdash projects.
dbt
command.
lightdash generate
, lightdash preview
and lightdash start-preview
These commands rely on the warehouse credentials from the active project, as the dbt Cloud CLI does not expose credentials directly. Ensure the project’s credentials have access to all development and staging schemas for a seamless experience.
Empty warehouse credentials for new projects
Affected commands: lightdash deploy --create
When using this command to create a new project that is not a preview, the warehouse credentials will not be populated automatically. Users must update the warehouse credentials manually in the project settings page after the project is created.
--version
or -V
Ignores the preceding command and shows the installed CLI version. Usually it’s used right after lightdash
, like this:
--help
or -h
Tells you what the preceding command does and lists all command-specific options. You can view the Lightdash CLI help like this:
--help
or -h
option with a speific command:
--verbose
Defaults to OFF. When included, each step will print logs as it progresses through the command. For example, here’s a --verbose
version of lightdash generate-exposures
:
Command | Description |
---|---|
lightdash login | Log in to a Lightdash instance using email/password or a token |
lightdash config set-project | Choose or set the Lightdash project you are working on |
lightdash compile | Compile lightdash resources using your local project files |
lightdash preview | Create a temporary preview project, then wait for a keypress to stop |
lightdash start-preview | Create a preview project that stays open until it is stopped |
lightdash stop-preview | Shut down an open preview project |
lightdash deploy | Compile and deploy a Lightdash project using your local project and credentials |
lightdash refresh | Refresh Lightdash project with remote repository |
lightdash validate | Validate content from your active project against your local project files |
lightdash generate | Generate or update schema.yml file(s) for the selected model(s) |
lightdash dbt run | Run dbt, then generate or update schema.yml file(s) for the selected model(s) |
lightdash generate-exposures | [Experimental command] Generates a YAML file for Lightdash exposures |
lightdash download | Download all charts and dashboards from your Lightdash project as code |
lightdash upload | Upload charts and dashboards as code to your Lightdash project |
lightdash rename | Rename model or field names across all your Lightdash content |
lightdash login
[URL]
--token
--token
to log in with email and password):
lightdash config set-project
lightdash validate
and lightdash preview
. If your organization only has one project you won’t need to use this!
--name
--uuid
lightdash compile
lightdash compile
.
Examples:
Compile the whole project:
accounts
dbt model, then your Lightdash explores:
production
profile from your local profiles.yml
file:
lightdash preview
lightdash preview
.
Options:
--name [preview name]
--start-of-week [number]
--skip-dbt-compile
dbt compile
and deploy from the existing ./target/manifest.json--skip-warehouse-catalog
--use-dbt-list [true/false]
dbt list
instead of dbt compile
to generate dbt manifest.json--ignore-errors
marketing
:
lightdash start-preview
lightdash start-preview
.
Required argument:
--name [preview name]
--start-of-week [number]
--skip-dbt-compile
dbt compile
and deploy from the existing ./target/manifest.json--skip-warehouse-catalog
--use-dbt-list [true/false]
dbt list
instead of dbt compile
to generate dbt manifest.json--ignore-errors
lightdash stop-preview
--name [preview name]
lightdash deploy
lightdash deploy
.
Options:
--create [project_name]
--ignore-errors
--start-of-week [number]
--skip-dbt-compile
dbt compile
and deploy from the existing ./target/manifest.json.--skip-warehouse-catalog
--use-dbt-list [true|false]
dbt list
instead of dbt compile
to generate dbt manifest.json.production
credentials from your local dbt profiles.yml
:
lightdash refresh
lightdash validate
lightdash validate
.
Options:
--project [project uuid]
--preview
--skip-dbt-compile
dbt compile
and deploy from the existing ./target/manifest.json.--skip-warehouse-catalog
--use-dbt-list [true/false]
dbt list
instead of dbt compile
to generate dbt manifest.json.--only [elems...]
lightdash generate
schema.yml
file or updates existing schema.yml
for selected model(s).
All standard dbt options work with lightdash generate
.
Options:
-y
or --assume-yes
--exclude-meta
--preserve-column-case
lightdash generate-exposures
schema.yml
file for Lightdash exposures.
--project-dir [path]
--output [path]
lightdash-exposures.yml
in the current directory with all exposures in Lightdash:
lightdash dbt run
schema.yml
file(s) for models that have columns missing or changed from the existing schema.yml
files.
Any dbt option that works with dbt run
will also work with lightdash dbt run
. That includes all the Lightdash dbt options, and more (see dbt run docs).
Options:
--exclude-meta
-y
or --assume-yes
-no
or --assume-no
--preserve-column-case
schema.yml
file:
lightdash download
lightdash
directory is created in your working directory and all of the charts and dashboards are written there as .yml files.
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
).
You can make changes to the code and upload these changes back to your Lightdash project. Content that’s been downloaded as code can still be managed in the Lightdash UI.
Options:
--charts
or -c
--dashboards
or -d
--path
or -p
--project <project uuid>
123-project-uuid
https://app.lightdash.cloud/projects/123-project-uuid/
/Users/katiehindson/lightdash/lightdash-analytics/
/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 upload
lightdash/
directory in your dbt project to your Lightdash project. To upload new content as code to your project, you need to use the option --force
(see Options below).
If there have been changes made to a chart or dashboard in the application that is being uploaded from code, lightdash upload
will overwrite the changes.
Options:
--force
lightdash upload --force
to create these new charts and dashboards. Otherwise, lightdash upload
only uploads updates to existing content.--charts
or -c
--dashboards
or -d
--path
or -p
--project <project uuid>
123-project-uuid
https://app.lightdash.cloud/projects/123-project-uuid/
lightdash/
directory to your Lightdash project.
/Users/katiehindson/lightdash/lightdash-analytics/
/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/
directory to a specific project.
lightdash rename
--type
field
or model
--from
num_users
)--to
count_distinct_user_id
)--project
, -p
lightdash config set-project
)--model
, -m
--dry-run
--list
--assume-yes
, -y
num_users
to count_distinct_user_id
.
users_mart_v1
to users
.
count
to count_distinct_order_id
in the orders
model and list all affected content when complete:
--select [models...]
or -s [models...]
--exclude [models...]
--selector [selector_name]
--project-dir [path]
--profiles-dir [path]
--profile [name]
--target [name]
--no-version-check
--state [state]
--full-refresh
--defer
(works with lightdash preview
and lightdash compile
)--vars [vars]
--threads [number]