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

# Customer Db README: Inputs, Cost & CLI Example

> Upserting row-shaped company results from the shared free company corpus into enrichments.companies in the tenant customer DB.

## Run in Enrichment Spreadsheet

<Info>
  Use this function as a column step in `deepline enrich`.
</Info>

```bash theme={null}
deepline enrich --input leads.csv --output leads.enriched.csv --with 'result=customer_db_materialize_free_customer_companies:{"sql":"{{sql}}"}' --json
```

<Tip>
  Map payload values to spreadsheet columns with `{{column_name}}` placeholders.
</Tip>

## Input Schema

| Name          | Type     | Required | Default | Description                                                                                                                                                                                                                                                                                                                                                                  |
| ------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `payload.sql` | `string` | Yes      |         | Single read-only SQL statement to execute against the shared free company corpus before upserting rows into enrichments.companies. SQL must include LIMIT, LIMIT must be \<= 100000, and the result columns must be limited to: domain, company\_name, industry, location, linkedin\_url, employee\_count, year\_founded. Aggregate-only shapes like count(\*) are rejected. |

<details>
  <summary>Show raw input schema</summary>

  ### Input JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Run a single read-only SQL statement against the shared free company corpus and upsert the returned company rows into enrichments.companies in the tenant customer DB. Only row-shaped company results are allowed.",
    "properties": {
      "sql": {
        "type": "string",
        "description": "Single read-only SQL statement to execute against the shared free company corpus before upserting rows into enrichments.companies. SQL must include LIMIT, LIMIT must be <= 100000, and the result columns must be limited to: domain, company_name, industry, location, linkedin_url, employee_count, year_founded. Aggregate-only shapes like count(*) are rejected.",
        "minLength": 1
      }
    },
    "required": [
      "sql"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Output Schema

| Name               | Type      | Required | Default | Description |
| ------------------ | --------- | -------- | ------- | ----------- |
| `result.schema`    | `string`  | Yes      |         |             |
| `result.processed` | `integer` | Yes      |         |             |
| `result.inserted`  | `integer` | Yes      |         |             |
| `result.updated`   | `integer` | Yes      |         |             |
| `result.sql`       | `string`  | Yes      |         |             |
| `result.limit`     | `integer` | Yes      |         |             |

<details>
  <summary>Show raw output schema</summary>

  ### Output JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "properties": {
      "schema": {
        "type": "string"
      },
      "processed": {
        "type": "integer"
      },
      "inserted": {
        "type": "integer"
      },
      "updated": {
        "type": "integer"
      },
      "sql": {
        "type": "string"
      },
      "limit": {
        "type": "integer"
      }
    },
    "required": [
      "schema",
      "processed",
      "inserted",
      "updated",
      "sql",
      "limit"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Advanced: Direct CLI

<Info>
  Use direct execution for single payload debugging.
</Info>

```bash theme={null}
deepline tools execute customer_db_materialize_free_customer_companies --payload '{
  "sql": "string"
}' --json
```

### CLI flags

| Flag                        | Description                                         |
| --------------------------- | --------------------------------------------------- |
| `--json`                    | Print machine-readable output.                      |
| `--wait`                    | Wait for terminal provider status when supported.   |
| `--debug`                   | Enable wait mode with additional status/log output. |
| `--wait-timeout SECONDS`    | Max seconds to wait in wait mode.                   |
| `--poll-interval SECONDS`   | Polling interval in seconds during wait mode.       |
| `--timeout SECONDS`         | Request timeout in seconds.                         |
| `--connect-timeout SECONDS` | Connection timeout in seconds.                      |

## Cost

* Pricing model: `fixed` (per call).
* Estimated Deepline credits: `0` per pricing unit.
* Provider-native pricing may still exist outside Deepline credit billing.
* Billing mode: `no_bill`.
