Tools

Home
JSON FormatterSQL FormatterJS ValidatorMinify CSS
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

SQL to YAML Transformer

Paste SQL INSERT statements and instantly convert them to clean YAML format with type inference and NULL handling

Your files never leave your browser
Input (SQL)0 chars, 0 lines
Output (YAML)0 chars, 0 lines
Ready·

Paste SQL INSERT statements and get structured YAML back — table names become top-level keys, columns map to fields, and each row turns into a list item with correct types (numbers, booleans, nulls all handled). And everything runs in your browser. Nothing gets uploaded.

How It Works

Paste SQL INSERTs
→
Parse & Infer Types
→
Get YAML Output

The parser splits your SQL into table name, column list, and value tuples. Each row becomes a YAML mapping where column names are keys. Type inference kicks in automatically — integers and decimals stay unquoted, NULL maps to YAML null, and booleans convert to lowercase true/false. Strings with special YAML characters (colons, hashes, brackets) get wrapped in quotes so the output is always valid.

Examples

Simple User Table

A basic two-row insert with mixed types — strings, an integer, and an email.

INPUT
INSERT INTO users (name, age, email) VALUES ('Alice', 28, '[email protected]'), ('Bob', 35, '[email protected]');
OUTPUT
users: - name: Alice age: 28 email: [email protected] - name: Bob age: 35 email: [email protected]

Product Catalog with NULLs and Decimals

Real-world data often has missing values. Here's how NULLs and prices with decimals come through.

INPUT
INSERT INTO products (sku, name, price, discount) VALUES ('WDG-401', 'Widget Pro', 29.99, NULL), ('BLT-220', 'Bolt Pack', 4.50, 0.10), ('NUT-113', 'Hex Nut Set', 12.00, NULL);
OUTPUT
products: - sku: WDG-401 name: Widget Pro price: 29.99 discount: null - sku: BLT-220 name: Bolt Pack price: 4.50 discount: 0.10 - sku: NUT-113 name: Hex Nut Set price: 12.00 discount: null

Config Flags with Booleans

Feature flags from a settings table — booleans get converted to YAML-native true/false.

INPUT
INSERT INTO feature_flags (flag, enabled, env) VALUES ('dark_mode', TRUE, 'prod'), ('beta_api', FALSE, 'staging');
OUTPUT
feature_flags: - flag: dark_mode enabled: true env: prod - flag: beta_api enabled: false env: staging

Who Uses This

💻 DevOps Engineers

Turn database exports into Ansible vars or Kubernetes ConfigMaps without reformatting by hand.

👨‍💻 Backend Developers

Convert seed data from SQL dumps into YAML fixtures for test suites and local dev environments.

📊 Data Analysts

Pull reference tables out of a database and drop them into YAML for documentation or config files.

🎓 Students

Quickly see how SQL row data maps to YAML structure when learning about data serialization formats.

Common Mistakes

Pasting SELECT queries instead of INSERTs

This tool parses INSERT INTO statements specifically. A SELECT result set doesn't have the same structure. Export your query results as INSERT statements first (most database clients have that option), then paste those.

Missing column names in the INSERT

If your SQL uses INSERT INTO table VALUES (...) without listing columns, the converter can't generate meaningful YAML keys. Always include the column list: INSERT INTO table (col1, col2) VALUES (...).

Strings with embedded single quotes

SQL escapes quotes by doubling them: 'O''Brien'. The parser handles this correctly. But if your export tool used backslash escaping ('O\'Brien'), results might be off. Stick with standard SQL quoting and you're fine.

Technical Details

Frequently Asked Questions

How do I convert SQL to YAML?

Paste your SQL INSERT INTO statement into the input box and click Convert. The tool reads the table name, column names, and values, then outputs each row as a YAML mapping. It takes about two seconds for most inputs.

Can I convert multiple INSERT statements at once?

Yes. Paste several INSERT statements separated by semicolons. Each table becomes its own top-level YAML key, and all rows from that table are grouped under it as a list.

What's the difference between block style and flow style YAML?

Block style puts each key on its own line with indentation. It is easier to read and edit by hand. Flow style uses curly braces and commas on a single line, similar to JSON. Block style is what most people want for config files.

Does SQL to YAML conversion keep data types?

The converter infers types from your SQL values. Numbers stay as numbers, NULL becomes YAML null, and TRUE/FALSE become native booleans. Strings are output as plain scalars unless they contain special characters, in which case they get quoted.

Is it safe to paste production SQL data here?

Your data never leaves your browser. The entire conversion happens client-side in JavaScript — no server calls, no storage, no cookies. You can disconnect from the internet and the tool still works. That said, don't paste actual passwords or secrets into any web tool as a general habit.

Share: