Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close
my2pg.py: MySQL to PostgreSQL database conversion
----------------------------------------------------

Copyright (c) 2010 Matrix Group International.
Licensed under the MIT license; see LICENSE file for terms.

Converts a MySQL database to a PostgreSQL database by reading the
MySQL system tables and then converting the data.

Aims for compatibility with PostgreSQL 8.2.7, since this is the
version supported in Ubuntu LTS at the moment.

Issues for MatrixMaxx databases: 

* pleasewait.starttime has 'on update' trigger. 

* Often have duplicated indexes -- psql reports an error and future
  SQL commands raise an exception.


Usage: my2pg.py [options] mysql-host mysql-db pg-host pg-db

Options:
  -h, --help            show this help message and exit
  --data-only           Assume the tables already exist, and only convert data
  --drop-tables         Drop existing PostgreSQL tables (if any) before
                        creating
  -n, --dry-run         Make no changes to PostgreSQL database
  --mysql-user=MYSQL_USER
                        User for login if not current user.
  --mysql-password=MYSQL_PASSWORD
                        Password to use when connecting to server.
  --pg-user=PG_USER     User for login if not current user.
  --pg-password=PG_PASSWORD
                        Password to use when connecting to server.
  --pickle==PICKLE      File for storing a pickled version of the MySQL table
                        structure.
  --starting-table=STARTING_TABLE
                        Name of table to start conversion with
  -v, --verbose         Display more output as the script runs

Example:
./my2pg.py -v -v
   --mysql-user=amk
   --mysql-password=mysqlpw
   --pg-user=amk --drop-tables 
   mysqlhost mysqldbname localhost pgdbname



A.M. Kuchling 
amk@amk.ca

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.