Skip to main content
The Lightdash CLI is how you build and ship your semantic layer. It runs against your dbt project on your own machine, so you can write metrics and dimensions, see them working, and promote them to production without leaving your editor. Start by installing the CLI and authenticating against your instance.

The development loop

Most work follows the same cycle. Write your semantic layer. lightdash generate writes a starting schema.yml for each model with an entry per column, so you edit rather than author from scratch. lightdash compile builds your project locally to confirm the YAML resolves. Check your work before it ships. lightdash preview spins up a temporary project from your local changes so you can query real data without touching production. lightdash validate reports content that your changes would break — a chart referencing a field you renamed, for instance — and lightdash lint checks your Lightdash Code files against their schemas. Ship it. lightdash deploy pushes the compiled project to production. In CI, the same commands run on every pull request — see setting up CI/CD.

Managing content as code

Charts, dashboards, agents, and data apps can round-trip through the CLI as well as the UI. lightdash download pulls them into your repository as files and lightdash upload sends them back, which is how you version content, review it in a pull request, or copy it between projects. See content as code.

Every command and flag

The CLI reference documents every command, flag, and environment variable.

How to install the Lightdash CLI

Install the Lightdash CLI with Homebrew, NPM, WSL, or a direct binary download

Authenticate the CLI

Log in with browser OAuth, a personal access token, or CI environment variables, and set your active project

Generate semantic layer YAML

Auto-generate and sync schema.yml files so your dbt models appear as Tables in Lightdash

Deploy changes to production

Push your local dbt project to production, or refresh metadata from your connected git repository

Validate content

Find the content in your project that is broken, and the details of each error

Lint your code

Validate your Lightdash Code files against JSON schemas before deploying to catch errors early

Compile changes

Add a GitHub Action that compiles your dbt project and catches Lightdash errors on every pull request

Lightdash CLI reference

Every Lightdash CLI command, its flags, and what it does