Skip to content

Introduction

sql-splitter is a command-line tool for working with SQL dump files. It’s designed for:

  • Automation: JSON output, consistent exit codes, glob patterns
  • CI/CD pipelines: Validation, integrity checks, reproducible operations
  • Large files: Streaming architecture handles multi-GB dumps with constant memory
  • Database migrations: Convert between MySQL, PostgreSQL, SQLite, and MSSQL

Break large dumps into per-table files for easier editing, then reassemble them:

Terminal window
sql-splitter split dump.sql -o tables/
# Edit individual table files...
sql-splitter merge tables/ -o updated.sql

Migrate data between different databases:

Terminal window
sql-splitter convert mysql.sql --to postgres -o postgres.sql

Sample production data while preserving foreign key relationships:

Terminal window
sql-splitter sample prod.sql -o dev.sql --percent 10 --preserve-relations

Check integrity before restoring to production:

Terminal window
sql-splitter validate dump.sql --strict

Redact PII for safe sharing:

Terminal window
sql-splitter redact dump.sql -o safe.sql --hash "*.email" --fake "*.name"

Run SQL queries directly on dump files using DuckDB:

Terminal window
sql-splitter query dump.sql "SELECT COUNT(*) FROM users"
  • Installation - Install sql-splitter
  • Quick Start - Your first split → edit → merge workflow
  • Concepts - Understand dialects, streaming, and compression