Skip to main content

Copy data from MySQL to PostgreSQL

Project description

MySQL to PostgreSQL

Copy rows from MySQL to PostgreSQL quickly.

Install

pip3 install mysql2pg

Documentation

Mysql2pg copies records from MySQL tables to existing PostgreSQL tables.

Mysql2pg also resets sequences, based on the maximum column value.

Performance is limited by network bandwidth, database resources, record size, and parallelism. In anecdotal usage, performance is 500k records/min serially.

Supported

  • Parallelism
  • Foreign keys
  • PostgreSQL schema

Not supported

  • Creating PostgreSQL tables. If you need to convert schema, look at other tools like mysql2postgres.
  • Limiting the tables.

Implementation

  1. MySQL tables are discovered.

  2. PostgreSQL tables are truncated.

  3. PostgreSQL triggers (including foreign keys) are disabled.

  4. Records are streamed from MySQL and uploaded to PostgreSQL via the COPY command.

  5. Sequences are discovered and reset based on the maximum value in the column.

Tables are processed in parallel.

Usage

usage: mysql2pg [-h] [--parallelism PARALLELISM] [--pg-search-path PG_SEARCH_PATH]

Copy records from MySQL to PostgreSQL

options:
  -h, --help            show this help message and exit
  --parallelism PARALLELISM
                        Number of tables to process in parallel
  --pg-search-path PG_SEARCH_PATH
                        PostgreSQL search path

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

mysql2pg-1.2.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

mysql2pg-1.2.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file mysql2pg-1.2.0.tar.gz.

File metadata

  • Download URL: mysql2pg-1.2.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for mysql2pg-1.2.0.tar.gz
Algorithm Hash digest
SHA256 840f32884557ef3fa541c73afc5699cc17680a4d8b475720a689a950635fc368
MD5 4e57fd5cc78ecfd69980c417ca5c96e0
BLAKE2b-256 53c09b0a26a33582cd72e7e43cfa4be956af43a1d84a4766f47ebba07c94968c

See more details on using hashes here.

File details

Details for the file mysql2pg-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: mysql2pg-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for mysql2pg-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0737ba9c4992689f3431a3720b4b992e39ae6bfe964153754cb8624dedeb6605
MD5 73898b9833088567909911d297526b90
BLAKE2b-256 89a93f7527a1349220bca87febc0946154086ed05516a55f66b2e1493e9d6eaa

See more details on using hashes here.

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