README
author Radek Brich <radek.brich@devl.cz>
Sun, 10 Mar 2013 16:14:53 +0100
changeset 76 3a41b351b122
parent 34 98c7809af415
child 83 515fadd3d286
permissions -rw-r--r--
Port pgconsole to Python3 + GTK3.
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
76
3a41b351b122 Port pgconsole to Python3 + GTK3.
Radek Brich <radek.brich@devl.cz>
parents: 34
diff changeset
     5
Requirements
3a41b351b122 Port pgconsole to Python3 + GTK3.
Radek Brich <radek.brich@devl.cz>
parents: 34
diff changeset
     6
------------
3a41b351b122 Port pgconsole to Python3 + GTK3.
Radek Brich <radek.brich@devl.cz>
parents: 34
diff changeset
     7
3a41b351b122 Port pgconsole to Python3 + GTK3.
Radek Brich <radek.brich@devl.cz>
parents: 34
diff changeset
     8
 * Python 3.2+
3a41b351b122 Port pgconsole to Python3 + GTK3.
Radek Brich <radek.brich@devl.cz>
parents: 34
diff changeset
     9
 * Psycopg2
3a41b351b122 Port pgconsole to Python3 + GTK3.
Radek Brich <radek.brich@devl.cz>
parents: 34
diff changeset
    10
3a41b351b122 Port pgconsole to Python3 + GTK3.
Radek Brich <radek.brich@devl.cz>
parents: 34
diff changeset
    11
Optional:
3a41b351b122 Port pgconsole to Python3 + GTK3.
Radek Brich <radek.brich@devl.cz>
parents: 34
diff changeset
    12
 * MyManager:
3a41b351b122 Port pgconsole to Python3 + GTK3.
Radek Brich <radek.brich@devl.cz>
parents: 34
diff changeset
    13
   * MySQLdb 1.2.3
3a41b351b122 Port pgconsole to Python3 + GTK3.
Radek Brich <radek.brich@devl.cz>
parents: 34
diff changeset
    14
   * see extras for Python3 patch
3a41b351b122 Port pgconsole to Python3 + GTK3.
Radek Brich <radek.brich@devl.cz>
parents: 34
diff changeset
    15
 * pgconsole:
3a41b351b122 Port pgconsole to Python3 + GTK3.
Radek Brich <radek.brich@devl.cz>
parents: 34
diff changeset
    16
   * GTK3 + Python bindings + Cairo + GtkSource
3a41b351b122 Port pgconsole to Python3 + GTK3.
Radek Brich <radek.brich@devl.cz>
parents: 34
diff changeset
    17
   * packages in Debian: python3-gi python3-gi-cairo gir1.2-gtk-3.0 gir1.2-gtksource-3.0
3a41b351b122 Port pgconsole to Python3 + GTK3.
Radek Brich <radek.brich@devl.cz>
parents: 34
diff changeset
    18
 * browser:
3a41b351b122 Port pgconsole to Python3 + GTK3.
Radek Brich <radek.brich@devl.cz>
parents: 34
diff changeset
    19
   * tuikit (http://hg.devl.cz/tuikit)
3a41b351b122 Port pgconsole to Python3 + GTK3.
Radek Brich <radek.brich@devl.cz>
parents: 34
diff changeset
    20
0
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    21
General Python Modules
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    22
----------------------
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    23
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    24
pgmanager.py - Database connection manager (pooling etc.)
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    25
pgbrowser.py - Schema browser module
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    26
pgdiff.py - Schema diff tool
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    27
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    28
Graphical and Command Line Tools
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    29
--------------------------------
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    30
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    31
pgbrowser-gtk.py - Database browser - graphical interface (GTK)
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    32
pgconsole-gtk.py - Query console - graphical interface (GTK)
eaae9539e910 Postgres tools.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    33
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
    34
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    35
MySQL - mytoolkit
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    36
-----------------
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    37
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    38
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
    39
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
    40
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
    41
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    42
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
    43
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
    44
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    45
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
    46
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
    47
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
    48
a9e12b7cc207 Fix MyManager. Add patch for MySQLdb and Python3.2. Add DelayedQuery.
Radek Brich <radek.brich@devl.cz>
parents: 0
diff changeset
    49
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
    50
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
    51
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
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
    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
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
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
    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
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
./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
    59
  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
    60
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
./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
    62
  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
    63
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
./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
    65
  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
    66
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    67
./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
    68
  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
    69
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    70
./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
    71
  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
    72
98c7809af415 Add PgDataCopy. Add TableCopyTool.Add SrcDstTablesTool class to toolbase, use in tablecopy, tablediff.
Radek Brich <radek.brich@devl.cz>
parents: 18
diff changeset
    73
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
    74
  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
    75
  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
    76
  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
    77
  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
    78
  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
    79
  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
    80
  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
    81