README
author Radek Brich <radek.brich@devl.cz>
Thu, 28 Feb 2013 12:55:25 +0100
changeset 69 1bf7d2f5e00c
parent 34 98c7809af415
child 76 3a41b351b122
permissions -rw-r--r--
Add doc for PgManager.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     1
=========
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     2
pgtoolkit
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     3
=========
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     4
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     5
General Python Modules
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     6
----------------------
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     7
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     8
pgmanager.py - Database connection manager (pooling etc.)
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     9
pgbrowser.py - Schema browser module
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    10
pgdiff.py - Schema diff tool
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    11
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    12
Graphical and Command Line Tools
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    13
--------------------------------
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    14
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    15
pgbrowser-gtk.py - Database browser - graphical interface (GTK)
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    16
pgconsole-gtk.py - Query console - graphical interface (GTK)
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    17
pgdiff-cli.py - Command line diff tool
18
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    18
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    19
MySQL - mytoolkit
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    20
-----------------
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    21
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    22
Package mytoolkit contains PgManager drop-in replacement for MySQL,
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    23
MyManager. This may be useful if MySQL interoperability is needed
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    24
for some reason.
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    25
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    26
MyManager requires MySQLdb module, which works only with Python 2.5 - 2.7.
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    27
You need patch for Python 3.2 - see `extras/MySQL-python-1.2.3-python3.patch`.
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    28
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    29
MyManager may be merged into PgManager in future, but currently there
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    30
isn't any generally usable python module for MySQL. MySQLdb isn't developed
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    31
anymore thus being practically dead, while alternatives are not mature enough.
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    32
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    33
Just use PostgreSQL with Python, it's better option in most use cases.
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    34
34
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    35
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    36
Tools
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    37
=====
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    38
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    39
tablecopy.py
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    40
------------
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    41
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    42
./tablecapy.py db1 db2 -n
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    43
  Read all tables and all schema from db1, print table names. Remove -n to copy data to db2.
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    44
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    45
./tablecopy.py db1 db2 -s myschema
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    46
  Copy all tables in "myschema" from db1 to db2.
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    47
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    48
./tablecopy.py db1 db2 -s myschema --dst-schema otherschema
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    49
  Copy all tables in "myschema" from db1 to same tables in "otherschema" in db2.
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    50
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    51
./tablecopy.py db1 db2 -s ^my --regex
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    52
  Copy all tables from all schemas beginning with "my".
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    53
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    54
./tablecopy.py db1 db2 -s myschema1 --dst-schema myschema2 --regex -t ^my
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    55
  Copy all tables beginning with "my" from myschema1 to tables of same name in myschema2.
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    56
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    57
Rules:
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    58
  If nothing is specified, everything is copied.
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    59
  If no target schema or table is specified, data are copied to schema or table of same name.
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    60
  If --regex is specified, it applies to table name if specified, schema name otherwise.
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    61
  If both --regex and --src-table is specified, both source and dest schema can be named (no regex applied to them).
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    62
  Default schema name is '', which as regex matches all schemas. Same for table name.
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    63
  Regexes are match with source database, destination database is not checked (table may not exists, will fail when copying).
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    64
  Directly specified table name (no --regex) is not checked (may not exists).
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    65