diff -r bd0beda49bcb -r 98c7809af415 README --- a/README Wed Mar 28 17:25:18 2012 +0200 +++ b/README Thu May 10 08:42:21 2012 +0200 @@ -32,3 +32,34 @@ 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). +