Skip to content

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.

  1. 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

    Dialect Auto-Detection

    sql-splitter automatically detects MySQL, PostgreSQL, SQLite, and MSSQL dumps. Override with --dialect:

    Terminal window
    # PostgreSQL pg_dump
    sql-splitter split pg_dump.sql -o tables/ --dialect=postgres
    # SQLite dump
    sql-splitter split sqlite.sql -o tables/ --dialect=sqlite
    # MSSQL/T-SQL
    sql-splitter split mssql.sql -o tables/ --dialect=mssql

    Split Specific Tables

    Only split the tables you need:

    Terminal window
    sql-splitter split dump.sql -o tables/ --tables users,orders

    Schema 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
  2. Edit Individual Tables

    Now you can:

    • Edit specific table files
    • Delete tables you don’t need
    • Modify INSERT statements
    • Add or remove indexes
  3. Merge Back

    Combine the per-table files back into a single dump:

    Terminal window
    sql-splitter merge tables/ -o restored.sql

    Wrap in Transaction

    For atomic restores:

    Terminal window
    sql-splitter merge tables/ -o restored.sql --transaction

    Merge Specific Tables

    Only merge certain tables:

    Terminal window
    sql-splitter merge tables/ -o partial.sql --tables users,orders

    Exclude Tables

    Skip certain tables when merging:

    Terminal window
    sql-splitter merge tables/ -o restored.sql --exclude logs,cache
  4. Verify the Result

    Analyze the merged file to verify:

    Terminal window
    sql-splitter analyze restored.sql

    Output:

    Found 4 tables:
    Table Name INSERTs Total Stmts Size (MB)
    ────────────────────────────────────────────────────────────────────────────────
    users 150 152 0.01
    orders 500 502 0.04
    products 100 102 0.01
    order_items 1200 1202 0.09
    ────────────────────────────────────────────────────────────────────────────────
    TOTAL 1950 - 0.15