> ## Documentation Index
> Fetch the complete documentation index at: https://deepline.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# deepline db

> Query the tenant customer database.

## db

```text theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
Usage: deepline db [options] [command]

Query the tenant customer database.

Options:
  -h, --help        display help for command

Commands:
  query [options]   Run SQL against the tenant customer database.
  repair [options]  Repair this workspace storage contract (role/DB grants). Org
                    admin only.
  help [command]    display help for command
```

## db query

```text theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
Usage: deepline db query [options]

Run SQL against the tenant customer database.

Options:
  --sql <sql>            SQL statement
  --dry-run              Describe the request, effects and recovery without
                         executing SQL or writing an export
  --max-rows <n>         Maximum returned rows
  --operation-key <key>  Recover this intended transactional SQL operation;
                         separate intentions need separate keys
  --format <format>      Output format: table, json, csv, or markdown
  --out <path>           Write csv or markdown output to a file
  --json                 Emit raw JSON response
  -h, --help             display help for command
```

```text theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
Explanation:
  Purpose:
    Run SQL against the workspace's customer database, where play runs persist
    their result rows.
  When:
    To read result rows in place (filter, join, count) instead of exporting,
    or to write to your own storage.* tables.
  Input:
    --sql "<statement>" or --sql @file.sql (required). --max-rows <n>,
    --format table|json|csv|markdown, --out <path> for csv or markdown, --json.
    Table names come from runs get: datasets[].storage {schema, table}, for
    example "storage"."prebuilt_person_to_phone_batch_phone_rows"; quote both
    parts. actions.queryTableSqlCmds[] has a ready query for each dataset.
  Output (JSON):
    command ("SELECT" and so on), rows[] (one object per row), columns[]
    {name}, row_count, row_count_returned, truncated (true when --max-rows or
    the server bound cut the result), next.
  Cost:
    Free.
  Avoid:
    Do not guess table names; a run's dataset table is named in runs get
    under datasets[].storage.
```

## db repair

```text theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
Usage: deepline db repair [options]

Repair this workspace storage contract (role/DB grants). Org admin only.

Options:
  --provider <provider>  Limit materialized-table repair to one provider
  --json                 Emit raw JSON response
  -h, --help             display help for command
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.