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

# Python & SQL

> Run AI-assisted Python and SQL transformations on your tables and spaces.

When the built-in actions don't cover a transformation you need, drop down to code. The **Python** and **SQL** actions let you transform data on the Workflow canvas with AI assistance — describe what you want, and Corvic helps write the code, which you can then review, edit, and run.

## When to use them

Use Python or SQL for custom logic that the dedicated actions (Augment, Join, Extract Tables, and so on) don't express directly:

* Reshaping, pivoting, or aggregating columns
* Custom cleaning, parsing, or feature derivation
* Filtering and reformatting before embedding
* Calling external APIs from your [API Secret Vault](/features/api-secret-vault) (Python)

<Note>
  On the canvas these appear as **Python** (`execute_python`) and **SQL** (`execute_sql`) actions. The agent's reasoning chain refers to the same `execute_python` capability when it runs code to answer a question.
</Note>

## Python

The Python action runs an AI-assisted Python transform over the input table. Describe the transformation in plain language; Corvic drafts the code, and you can inspect and modify it before running.

Python is also how agents call connected external APIs — credentials from the [API Secret Vault](/features/api-secret-vault) are injected automatically, so your code references a connection by name rather than handling raw secrets.

<div className="doc-placeholder">📸 <span><strong>Screenshot to add:</strong> the Python action panel (prompt, generated code, run) — save as <code>/images/action-python.png</code></span></div>

## SQL

The SQL action runs an AI-assisted SQL query over the input table. Use it for set-based transformations — joins, aggregations, window functions, and filtering — expressed in familiar SQL.

<div className="doc-placeholder">📸 <span><strong>Screenshot to add:</strong> the SQL action panel (prompt, generated query, run) — save as <code>/images/action-sql.png</code></span></div>

## Where they run

Python and SQL actions can be applied to **Corvic Table** outputs, and can also run directly on **Space** outputs — letting you post-process embeddings and their associated data without leaving the canvas.

## Usage

<Steps>
  <Step title="Add the action">
    Click the **+** next to a table or space node and choose **Python** or **SQL**.
  </Step>

  <Step title="Describe the transform">
    Write what you want in plain language. Corvic generates the code or query.
  </Step>

  <Step title="Review and edit">
    Inspect the generated code, adjust it as needed, and copy it if you want to reuse it.
  </Step>

  <Step title="Run">
    Execute the action to produce a new output you can use downstream.
  </Step>
</Steps>

## Related Documentation

<CardGroup cols={2}>
  <Card title="Workflows" icon="window" href="/features/workflows">
    Build pipelines on the canvas.
  </Card>

  <Card title="API Secret Vault" icon="key" href="/features/api-secret-vault">
    Call external APIs from Python.
  </Card>

  <Card title="Action Reference" icon="table-list" href="/reference/action-types">
    See all available canvas actions.
  </Card>
</CardGroup>
