Skip to content

Commit 89b52e6

Browse files
owlasmintlify[bot]
andauthored
Update references/lightdash-cli.mdx
Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
1 parent 4af2d44 commit 89b52e6

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

references/lightdash-cli.mdx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,54 @@ Show diagnostic information with dbt debug for a specific project directory:
755755
lightdash diagnostics --dbt --project-dir ./my-dbt-project
756756
```
757757

758+
### `lightdash sql`
759+
760+
Run a raw SQL query against your data warehouse using the credentials from your currently selected project. Results are exported to a CSV file.
761+
762+
```console
763+
lightdash sql <query> -o <output_file>
764+
```
765+
766+
**Required argument:**
767+
768+
- `<query>`
769+
- The SQL query to execute
770+
771+
**Required option:**
772+
773+
- `-o, --output <file>`
774+
- Output file path for CSV results
775+
776+
**Options:**
777+
778+
- `--limit <number>`
779+
- Maximum number of rows to return from the query
780+
- `--page-size <number>`
781+
- Number of rows per page (default: 500, max: 5000)
782+
- `--verbose`
783+
- (default: false)
784+
- Show detailed output
785+
786+
**Examples:**
787+
788+
Run a simple query and save results to a CSV file:
789+
790+
```bash
791+
lightdash sql "SELECT * FROM users LIMIT 100" -o users.csv
792+
```
793+
794+
Run a query with a row limit:
795+
796+
```bash
797+
lightdash sql "SELECT * FROM orders" -o orders.csv --limit 1000
798+
```
799+
800+
Run a query with verbose output to see detailed progress:
801+
802+
```bash
803+
lightdash sql "SELECT customer_id, SUM(amount) FROM orders GROUP BY 1" -o revenue.csv --verbose
804+
```
805+
758806
---
759807

760808
## dbt options

0 commit comments

Comments
 (0)