README
changeset 34 98c7809af415
parent 18 a9e12b7cc207
child 76 3a41b351b122
equal deleted inserted replaced
33:bd0beda49bcb 34:98c7809af415
    30 isn't any generally usable python module for MySQL. MySQLdb isn't developed
    30 isn't any generally usable python module for MySQL. MySQLdb isn't developed
    31 anymore thus being practically dead, while alternatives are not mature enough.
    31 anymore thus being practically dead, while alternatives are not mature enough.
    32 
    32 
    33 Just use PostgreSQL with Python, it's better option in most use cases.
    33 Just use PostgreSQL with Python, it's better option in most use cases.
    34 
    34 
       
    35 
       
    36 Tools
       
    37 =====
       
    38 
       
    39 tablecopy.py
       
    40 ------------
       
    41 
       
    42 ./tablecapy.py db1 db2 -n
       
    43   Read all tables and all schema from db1, print table names. Remove -n to copy data to db2.
       
    44 
       
    45 ./tablecopy.py db1 db2 -s myschema
       
    46   Copy all tables in "myschema" from db1 to db2.
       
    47 
       
    48 ./tablecopy.py db1 db2 -s myschema --dst-schema otherschema
       
    49   Copy all tables in "myschema" from db1 to same tables in "otherschema" in db2.
       
    50 
       
    51 ./tablecopy.py db1 db2 -s ^my --regex
       
    52   Copy all tables from all schemas beginning with "my".
       
    53 
       
    54 ./tablecopy.py db1 db2 -s myschema1 --dst-schema myschema2 --regex -t ^my
       
    55   Copy all tables beginning with "my" from myschema1 to tables of same name in myschema2.
       
    56 
       
    57 Rules:
       
    58   If nothing is specified, everything is copied.
       
    59   If no target schema or table is specified, data are copied to schema or table of same name.
       
    60   If --regex is specified, it applies to table name if specified, schema name otherwise.
       
    61   If both --regex and --src-table is specified, both source and dest schema can be named (no regex applied to them).
       
    62   Default schema name is '', which as regex matches all schemas. Same for table name.
       
    63   Regexes are match with source database, destination database is not checked (table may not exists, will fail when copying).
       
    64   Directly specified table name (no --regex) is not checked (may not exists).
       
    65