Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

CSV to SQL Converter API

Turn CSV into SQL: an optional CREATE TABLE with inferred column types, then batched INSERT statements, quoted for PostgreSQL, MySQL, SQLite or SQL Server.

POST /api/v1/tools/csv-to-sqlMCP csv_to_sqlData & Conversion

Turn CSV into CREATE TABLE and INSERT statements for PostgreSQL, MySQL, SQLite or SQL Server, with inferred column types, safe quoting and batched inserts.

Input

Send these as a JSON object. Unknown fields are rejected.

input
The CSV text. (string, required)
dialect
SQL dialect, which decides identifier quoting, string escaping and type names. (string, one of postgresql, mysql, sqlite, sqlserver, default "postgresql")
tableName
Table name, optionally schema-qualified (public.customers). (string, up to 200 characters, default "my_table")
delimiter
CSV delimiter: "auto" to detect, or a single character. (string, up to 4 characters, default "auto")
header
Use the first row as column names; otherwise columns are column_1, column_2… (boolean, default true)
createTable
Start with a CREATE TABLE statement. (boolean, default true)
batchSize
Rows per INSERT statement (1 to 1000). (integer, 1 to 1000, default 100)
emptyAsNull
Write NULL for every empty cell. When false, empty text cells become '' and other empty cells NULL. (boolean, default false)
inferTypes
Infer INTEGER, BIGINT, REAL, BOOLEAN, DATE and TIMESTAMP columns; when false every column is TEXT. (boolean, default true)
curl https://pithlab.com/api/v1/tools/csv-to-sql \n  -H "Authorization: Bearer $PITHLAB_KEY" \n  -H "Content-Type: application/json" \n  -d '{"input":"id,name,active\n1,Ada,true\n2,O'''Brien,false","tableName":"customers"}'