Skip to content

Commit

Permalink
Merge pull request #8 from lightdash/docs/adds-selector-content-as-code
Browse files Browse the repository at this point in the history
docs: adds selector docs to content as code
  • Loading branch information
TuringLovesDeathMetal authored Dec 17, 2024
2 parents 711f086 + 384980c commit ea1056d
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
64 changes: 64 additions & 0 deletions docs/references/content-as-code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,74 @@ For example:
- I run `lightdash download` again
- The changes I made to `emea-revenue-per-month.yml` will be overwritten by the latest chart version downloaded from the Lightdash application

### 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:

```bash
lightdash download -c https://app.lightdash.cloud/the-url-to-my-saved-chart
```

You can use the chart's SLUG, UUID, or the URL to the saved chart to select the chart.

### Use `lightdash download -d` or `lightdash download --dashboards` to select specific dashboards

For example, if I only wanted to download a specific dashboard as code, I would run the command:

```bash
lightdash download -d https://app.lightdash.cloud/the-url-to-my-dashboard
```

You can use the dashboard's SLUG, UUID, or the URL to the dashboard to select the dashboard.

#### To select multiple charts or dashboards, add a space between the items

For example, this command would select two charts to download:

```bash
lightdash download -c https://app.lightdash.cloud/the-url-to-my-first-saved-chart https://app.lightdash.cloud/the-url-to-my-second-saved-chart
```

You can combine charts and dashboards selection in a single command. For example, this command would download a chart and a dashboard:

```bash
lightdash download -c https://app.lightdash.cloud/the-url-to-my-first-saved-chart -d https://app.lightdash.cloud/the-url-to-my-dashboard
```

## `lightdash upload` updates any content as code to your project

From the [Lightdash CLI](/references/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`

### 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:

```bash
lightdash upload -c my-saved-chart-slug
```

You must specify the chart using the chart's SLUG.

### 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:

```bash
lightdash upload -d my-dashboard-slug
```

You must specify the dashboard using the dashboard's SLUG.

#### To select multiple charts or dashboards, add a space between the items

For example, this command would select two charts to upload:

```bash
lightdash upload -c my-saved-chart-1-slug my-saved-chart-2-slug
```

#### Only content as code that you've made changes to will be uploaded

For example:
Expand Down
23 changes: 23 additions & 0 deletions docs/references/lightdash-cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,13 @@ E.g. if you're running this command inside your dbt directory (eg: `/home/javi/d

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`
- select specific charts as code to download from your project. Use the chart SLUG, UUID or URL to specify the chart.
- `--dashboards` or `-d`
- select specific dashboards as code to download from your project. Use the dashboard SLUG, UUID or URL to specify the dashboard.

**Examples:**

Download all charts and dashboards from your project.
Expand All @@ -423,6 +430,12 @@ Download all charts and dashboards from your project.
lightdash download
```

Download a specific dashboard from your Lightdash project.

```bash
lightdash upload -d https://app.lightdash.cloud/my-dashboard-url
```

### `lightdash upload`

Uploads charts and dashboards that you've made changes to from the `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).
Expand All @@ -433,6 +446,10 @@ If there have been changes made to a chart or dashboard in the application that

- `--force`
- if you've created new content as code that doesn't exist in your Lightdash project yet, you need to run `lightdash upload --force` to create these new charts and dashboards. Otherwise, `lightdash upload` only uploads updates to existing content.
- `--charts` or `-c`
- select specific charts as code to upload back to your project. Use the chart SLUG to specify the chart.
- `--dashboards` or `-d`
- select specific dashboards as code to upload back to your project. Use the dashboard SLUG to specify the dashboard.

**Examples:**

Expand All @@ -442,6 +459,12 @@ Upload all charts and dashboards in code from your `lightdash/` directory to you
lightdash upload
```

Upload a specific dashboard to your Lightdash project.

```bash
lightdash upload -d my-dashboard-slug
```

## dbt options

These are options from the dbt Core CLI that also work with some Lightdash CLI commands.
Expand Down

0 comments on commit ea1056d

Please sign in to comment.