The SQL Dump Splitter is a Python tool designed to split large SQL dump files into smaller files based on specific conditions such as 'DROP TABLE' and 'CREATE TABLE IF NOT EXISTS'. This tool is useful for managing large SQL databases where dumps can be excessively large for efficient handling.
- Splits large SQL files into multiple smaller files.
- Supports customizable conditions to trigger a new split.
- Option to ignore blank lines.
- Generates a summary report of the splitting process.
To use this script, you will need Python 3.6 or higher. No additional external libraries are required.
No formal installation is necessary. The script can be cloned directly from the repository and run from the command line.
git clone https://github.com/davydmaker/sql-dump-splitter.git
cd sql-dump-splitter
To use the SQL Dump Splitter, run the script from the command line with the required parameters. Here is an example of how to use the script:
python3 sql_dump_splitter.py --input-file 'path/to/your/dump.sql' --output-dir 'path/to/output' --trigger-count 1 --ignore-blank-lines --report
--input-file
: Path to the SQL file you want to split.--output-dir
: Directory where the split files will be saved. If not provided, a directory with the name of the input file is created.--trigger-count
: Number of occurrences of the SQL conditions before saving a file (default: 1).--ignore-blank-lines
: Ignore blank lines in the file (default: False).--sql-conditions
: List of SQL conditions that trigger the file split.--report
: Display a summary report at the end of the execution.
Contributions are always welcome! If you have suggestions for improving the script or adding new features, feel free to fork the repository and submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.