Quick Start
This guide walks you through the most common sql-splitter workflow: splitting a dump into individual table files, editing them, and merging back.
-
Split a Dump
Split a MySQL dump into per-table files:
Terminal window sql-splitter split database.sql --output=tables/Output:
tables/├── users.sql├── orders.sql├── products.sql├── order_items.sql└── _global.sql # Header statements, settingsDialect Auto-Detection
sql-splitter automatically detects MySQL, PostgreSQL, SQLite, and MSSQL dumps. Override with
--dialect:Terminal window # PostgreSQL pg_dumpsql-splitter split pg_dump.sql -o tables/ --dialect=postgres# SQLite dumpsql-splitter split sqlite.sql -o tables/ --dialect=sqlite# MSSQL/T-SQLsql-splitter split mssql.sql -o tables/ --dialect=mssqlSplit Specific Tables
Only split the tables you need:
Terminal window sql-splitter split dump.sql -o tables/ --tables users,ordersSchema vs Data
Split only schema (DDL) or only data (DML):
Terminal window # Schema only (CREATE TABLE, indexes)sql-splitter split dump.sql -o schema/ --schema-only# Data only (INSERT statements)sql-splitter split dump.sql -o data/ --data-only -
Edit Individual Tables
Now you can:
- Edit specific table files
- Delete tables you don’t need
- Modify INSERT statements
- Add or remove indexes
-
Merge Back
Combine the per-table files back into a single dump:
Terminal window sql-splitter merge tables/ -o restored.sqlWrap in Transaction
For atomic restores:
Terminal window sql-splitter merge tables/ -o restored.sql --transactionMerge Specific Tables
Only merge certain tables:
Terminal window sql-splitter merge tables/ -o partial.sql --tables users,ordersExclude Tables
Skip certain tables when merging:
Terminal window sql-splitter merge tables/ -o restored.sql --exclude logs,cache -
Verify the Result
Analyze the merged file to verify:
Terminal window sql-splitter analyze restored.sqlOutput:
┌─────────────┬──────┬───────────┬─────────────┐│ Table │ Rows │ Size (KB) │ Statements │├─────────────┼──────┼───────────┼─────────────┤│ users │ 150 │ 12.3 │ 2 ││ orders │ 500 │ 45.2 │ 2 ││ products │ 100 │ 8.1 │ 2 ││ order_items │ 1200 │ 89.4 │ 2 │└─────────────┴──────┴───────────┴─────────────┘