Skip to main content

About

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.

Install

To install from pypi:

pip3 install --user mysqltotsv

Usage

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 mysql-to-tsv.py --file dump.sql --outdir out1

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

python3.7 mysql-to-tsv.py --file dump.sql --outdir out1 --table-filter=updates,updates_edited

More details about the CLI switches:

usage: mysql-to-tsv.py [-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

Ideas

  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.

Support

For questions or requests please send an e-mail to stefan.petrea@gmail.com

Metadata

Release files for mysqltotsv 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mysqltotsv 0.1.4
File Size Uploaded Provenance Actions
mysqltotsv-0.1.4.tar.gz 7.1 kB Without provenance Details for mysqltotsv-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mysqltotsv 0.1.4
File Interpreter ABI Platform Actions
mysqltotsv-0.1.4-py3-none-any.whl Python 3 none any Details for mysqltotsv-0.1.4-py3-none-any.whl

Total release size: 14.0 kB

Release files / mysqltotsv-0.1.4.tar.gz

Download URL mysqltotsv-0.1.4.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f6d1e760a429bfafa184b786fdc241fb7a0afc66120c9b1b9ec681568c5da489
BLAKE2b-256 checksum
How to use checksums
2536508f1f8396b768182aea651dcda98efb8d626761164dffad47d996293c26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release files / mysqltotsv-0.1.4-py3-none-any.whl

Download URL mysqltotsv-0.1.4-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9001bc8e3df3b413c575246f76799cd5e5b1e8a98abc202920ec2f33794b9f07
BLAKE2b-256 checksum
How to use checksums
8df519754bc02d6e1a86659134915fc05a728779f057c0c8244828b02be4abfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Security for mysqltotsv 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page