Skip to content

SQL to YAML Converter

Extract data from SQL INSERT statements and convert it into YAML. Paste one or many INSERT INTO ... VALUES statements and get a clean YAML list of records.

Category: data
Use Case: Database Export, Config Generation, SQL Dump Review
Privacy: 100% browser-based

Conversion Options

Recommended Settings

Pro Tips

  • Works with a single INSERT statement with many VALUES tuples, or multiple separate INSERT statements for the same table
  • Escaped single quotes ('') inside string values are automatically unescaped
  • NULL becomes YAML null, and TRUE/FALSE become real YAML booleans, not strings
  • If an INSERT statement doesn't list column names, generic column1, column2... keys are generated
  • By default, keys appear in the same order as the SQL column list - enable sorting for alphabetical order instead

Most Popular

Most users paste a batch of INSERT statements and leave keys unsorted to match the column order

When to Use This Tool

Config Generation from Seed Data

Turn a database seed script's INSERT statements into a YAML config file that your application, CI pipeline, or infrastructure tooling can load directly.

Reviewing SQL Dumps

Quickly inspect the actual data inside a large .sql backup or seed file by converting its INSERT statements into readable, structured YAML.

Test Fixtures & Seed Files

Convert INSERT statements used for database seeding into YAML fixtures for tests, mocks, or configuration-driven tools that read YAML.

Data Migration Between Systems

Bridge SQL-based systems and YAML-based tools or APIs by converting INSERT statement data directly into YAML documents.

How It Works

1

Split the SQL input into individual statements, respecting semicolons inside quoted strings

2

Filter to statements starting with INSERT INTO, and parse each one's table name, optional column list, and VALUES section

3

Extract each parenthesized VALUES tuple, correctly handling nested parentheses and commas inside quoted string values

4

Parse each value into its proper type: strings (with escaped quotes unescaped), numbers, booleans, or null

5

Map each row's values to the column names to build one record per row, then serialize the list as YAML

100% Private

Files never leave your device. All processing happens locally in your browser.

Lightning Fast

Powered by js-yaml for optimal performance on modern browsers.

Secure

No data collection, no tracking, no sign-up required.

Frequently Asked Questions

What SQL syntax does this tool support?

It parses standard INSERT INTO table (columns) VALUES (...), (...); statements, including statements without an explicit column list. CREATE TABLE statements and other SQL are ignored.

Can I convert multiple INSERT statements at once?

Yes. Paste any number of INSERT statements - whether they're multiple separate statements or one statement with many VALUES tuples - and all their rows are combined into a single YAML list.

What happens if column names aren't specified in the SQL?

If an INSERT statement doesn't list column names (e.g., INSERT INTO t VALUES (1, 'x')), generic keys like column1, column2 are generated based on the widest row.

How are strings, NULL, and booleans handled?

Single-quoted strings are unescaped ('' becomes a single quote), NULL becomes YAML null, and TRUE/FALSE become real YAML boolean values rather than the strings 'true'/'false'.

What does 'Sort keys alphabetically' do?

By default, keys in each YAML record appear in the same order as the SQL column list. Enabling this option instead sorts the keys alphabetically within each record.