Advertisement

YAML to SQL Insert

Convert YAML to SQL Insert free, in seconds. Paste your data below, press Convert, then copy the result and run it against MySQL, PostgreSQL or SQLite. Everything runs in your browser, so nothing is ever uploaded.

YAML input

Paste your YAML below, then press Convert.

Lists of maps convert best. Nested maps are flattened with dot notation.
Used in the INSERT INTO clause.

SQL Insert output

Waiting for YAML input.

Private by design: parsing uses the js-yaml library (loaded once from a CDN); the conversion itself happens locally and your data is never uploaded.
Advertisement

How this conversion works

Paste YAML into the input box and press Convert (or just keep typing, conversion happens as you type). The tool parses it with the js-yaml library, then generates a single multi-row INSERT statement, quoting strings, passing numbers through and turning blanks into NULL. Parsing uses the js-yaml library (loaded once from a CDN); the conversion itself happens locally and your data is never uploaded.

Running the SQL

The output is one multi-row INSERT statement, which loads faster than one statement per row. Strings are single-quoted with inner quotes doubled, numbers pass through unquoted, booleans become TRUE or FALSE, and empty values become NULL. Edit the Table name field before converting to target your real table; the name is sanitized to safe characters automatically.

YAML to SQL Insert FAQs

Why convert YAML to SQL INSERT?
INSERT statements are the universal way to seed a database: run the output in MySQL, PostgreSQL, SQLite or MariaDB to load exported data into a table in one step. It is handy for migrations, demos and test fixtures.
How is my YAML parsed?
With the js-yaml library. A list of maps becomes one row per item, a single map becomes one row, and nested maps are flattened with dot notation so tabular output stays clean.
Can I change the table name?
Yes. Edit the Table name field above the output before pressing Convert. It defaults to my_table and is sanitized to letters, numbers, underscores and dollar signs.
How are values quoted?
Strings are single-quoted with inner quotes doubled, numbers pass through unquoted, booleans become TRUE or FALSE, and empty values become NULL. Everything goes into one multi-row INSERT statement for speed.
Is my data sent to a server?
No. parsing uses the js-yaml library (loaded once from a CDN); the conversion itself happens locally and your data is never uploaded.
Advertisement