Skip to main content

Tool for conversion of MySQL dumps to TSV format

Project description


This module provides the mysqltotsv.Splitter class and a CLI tool to allow conversion of large MySQL dumps to the TSV format.

The module assumes the MySQL dump to be encoded in UTF-8 format.

This is primarily intended for large MySQL dumps where opening them with a text editor is impractical and handling them is easier through a tool.


To install from pypi:

pip3 install --user mysqltotsv


The following command takes a MySQL dump and creates a separate TSV file for each table found inside (the output directory needs to be present):

python3.7 --file dump.sql --outdir out1

There is also a switch to only process certain tables and skip the rest. Example:

python3.7 --file dump.sql --outdir out1 --table-filter=updates,updates_edited

More details about the CLI switches:

usage: [-h] --file FILE --outdir OUTDIR
                       [--table-filter TABLE_FILTER] [--only-schema]
                       [--strip-quotes] [--debug] [--ignore-errors]
                       [--estimate1] [--estimate2]

Tool for conversion of large MySQL dumps to TSV format

optional arguments:
  -h, --help            show this help message and exit
  --file FILE           mysql dump file
  --outdir OUTDIR       output directory
  --table-filter TABLE_FILTER
                        filtered tables
  --only-schema         write the schema to the output directory
  --strip-quotes        strip quotes from values
  --debug               print debug information
  --ignore-errors       ignore processing errors
  --estimate1           estimate row counts for each table inside the sql file
  --estimate2           estimate row counts for each table inside the sql file


  1. Rewrite the module to parse the entire INSERT INTO statement instead of the hybrid ad-hoc + grammar-based approach.
  2. Write a better estimator that samples a few records, measures their size, for each table, then measures the entire file size and computes an estimate based on that.


For questions or requests please send an e-mail to

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mysqltotsv-0.1.4.tar.gz (7.1 kB view hashes)

Uploaded Source

Built Distribution

mysqltotsv-0.1.4-py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page