export_schema¶
Render a file's column schema as SQL DDL, a Pydantic v2 model, a TypeScript interface, a JSON Schema document, or a Rust struct. Only the column list is read, no rows are serialised.
This is the MCP counterpart of the octa --export-schema
CLI action and the GUI's Schema Export
dialog; all three share the same renderers.
When to use¶
- Bootstrapping a database table from a real data file.
- Generating a typed model (Pydantic / TypeScript / Rust) so downstream code reads the file with the right types.
- Producing a JSON Schema for validation.
Input schema¶
| Parameter | Type | Required? | Default | Description |
|---|---|---|---|---|
path |
string | yes | (no default) | Path to the file |
target |
string | yes | (no default) | One of the targets in the table below |
table |
string | no | (no default) | Specific table for multi-table sources (SQLite, DuckDB) |
Targets¶
target value |
Output |
|---|---|
postgres |
CREATE TABLE in the Postgres dialect. |
mysql |
CREATE TABLE in the MySQL dialect (backticks, UNSIGNED). |
sqlite |
CREATE TABLE in the SQLite dialect (affinity types). |
databricks |
CREATE TABLE in the Databricks (Spark SQL / Delta) dialect. |
snowflake |
CREATE TABLE in the Snowflake dialect. |
pydantic |
Pydantic v2 BaseModel. |
typescript |
export interface. |
json-schema |
JSON Schema (draft 2020-12). |
rust |
pub struct with serde derives. |
Response shape¶
{
"target": "Snowflake",
"table_name": "sales",
"column_count": 4,
"code": "-- Generated by octa - Snowflake dialect\nCREATE TABLE sales ( … );\n"
}
Identifiers are emitted bare; names with spaces, punctuation, or a leading digit are quoted automatically.
Example call¶
For a specific table inside a multi-table database, add table:
{
"name": "export_schema",
"arguments": {
"path": "/data/app.sqlite",
"table": "users",
"target": "pydantic"
}
}
See also¶
- Schema Export: the same renderers in the GUI, including the full Arrow → target type-mapping table.
octa --export-schema: the CLI action.schema: returns the raw column list (no DDL).