README
author Radek Brich <radek.brich@devl.cz>
Wed, 09 Jul 2014 18:03:54 +0200
changeset 104 d8ff52a0390f
parent 83 515fadd3d286
permissions -rw-r--r--
Rename to pydbkit.

=========
 PyDbKit
=========

Requirements
------------

 * Python 3.2+
 * Psycopg2
 * pycolib <http://hg.devl.cz/pycolib>

Optional:
 * for MyManager:
   * MySQLdb 1.2.3
   * see extras for Python3 patch
 * for pgconsole.py:
   * GTK3 + Python bindings + Cairo + GtkSource
   * packages in Debian: python3-gi python3-gi-cairo gir1.2-gtk-3.0 gir1.2-gtksource-3.0
 * for browser.py:
   * tuikit (http://hg.devl.cz/tuikit)

General Python Modules
----------------------

pgmanager.py - Database connection manager (pooling etc.)
pgbrowser.py - Schema browser module
pgdiff.py - Schema diff tool

Graphical and Command Line Tools
--------------------------------

pgbrowser-gtk.py - Database browser - graphical interface (GTK)
pgconsole-gtk.py - Query console - graphical interface (GTK)
pgdiff-cli.py - Command line diff tool

MySQL - mytoolkit
-----------------

Package mytoolkit contains PgManager drop-in replacement for MySQL,
MyManager. This may be useful if MySQL interoperability is needed
for some reason.

MyManager requires MySQLdb module, which works only with Python 2.5 - 2.7.
You need patch for Python 3.2 - see `extras/MySQL-python-1.2.3-python3.patch`.

MyManager may be merged into PgManager in future, but currently there
isn't any generally usable python module for MySQL. MySQLdb isn't developed
anymore thus being practically dead, while alternatives are not mature enough.

Just use PostgreSQL with Python, it's better option in most use cases.


Tools
=====

tablecopy.py
------------

./tablecapy.py db1 db2 -n
  Read all tables and all schema from db1, print table names. Remove -n to copy data to db2.

./tablecopy.py db1 db2 -s myschema
  Copy all tables in "myschema" from db1 to db2.

./tablecopy.py db1 db2 -s myschema --dst-schema otherschema
  Copy all tables in "myschema" from db1 to same tables in "otherschema" in db2.

./tablecopy.py db1 db2 -s ^my --regex
  Copy all tables from all schemas beginning with "my".

./tablecopy.py db1 db2 -s myschema1 --dst-schema myschema2 --regex -t ^my
  Copy all tables beginning with "my" from myschema1 to tables of same name in myschema2.

Rules:
  If nothing is specified, everything is copied.
  If no target schema or table is specified, data are copied to schema or table of same name.
  If --regex is specified, it applies to table name if specified, schema name otherwise.
  If both --regex and --src-table is specified, both source and dest schema can be named (no regex applied to them).
  Default schema name is '', which as regex matches all schemas. Same for table name.
  Regexes are match with source database, destination database is not checked (table may not exists, will fail when copying).
  Directly specified table name (no --regex) is not checked (may not exists).