Skip to content

remove_mysql_tables

Martin Asser Hansen edited this page Oct 2, 2015 · 6 revisions

Biopiece: remove_mysql_tables

Description

remove_mysql_tables removes MySQL tables from the database specified with the -d switch. Tables to be removed can be specified with the -t switch and/or tables are removed if they exactly match the value of given record keys of records in the stream.

See how to setup default MySQL username and password here: http://code.google.com/p/biopieces/wiki/HowTo#Howto_setup_default_MySQL_username_and_password

For more about MySQL: http://www.mysql.com/

Usage

remove_mysql_tables [options] <-d <database>>  <-t <tables>>

or

... | remove_mysql_tables [options] <-d <database>> <-k <keys>>

Options

[-?          | --help]               #  Print full usage description.
[-d <string> | --database=<string>]  #  MySQL database.
[-t <list>   | --tables=<list>]      #  Comma separated list of tables.
[-k <list>   | --keys=<list>]        #  Comma separated list of keys.
[-u <string> | --user=<string>]      #  MySQL user name              -  Default=<from ~/.biopiecesrc>
[-p <string> | --password=<string>]  #  MySQL password               -  Default=<from ~/.biopiecesrc>
[-I <file!>  | --stream_in=<file!>]  #  Read input stream from file  -  Default=STDIN
[-O <file>   | --stream_out=<file>]  #  Write output stream to file  -  Default=STDOUT
[-v          | --verbose]            #  Verbose output.

Examples

To remove a specific table from a database:

remove_mysql_tables -d dm3 -t mah_RM_new

To assimilate a list of tables to remove do:

read_mysql -d dm3 -q 'show tables' | grab -p test_to_remove | remove_mysql_tables -d dm3 -k Tables_in_dm3 -x

Note that read_mysql with the show tables query outputs records of the type:

Tables_in_dm3: mah_test_to_remove
---

Thus we know that the -k value should be Tables_in_dm3.

See also

remove_ucsc_tracks

list_mysql_databases

read_mysql

remove_mysql_tables

write_mysql

Author

Martin Asser Hansen - Copyright (C) - All rights reserved.

mail@maasha.dk

November 2008

License

GNU General Public License version 2

http://www.gnu.org/copyleft/gpl.html

Help

remove_mysql_tables is part of the Biopieces framework.

http://www.biopieces.org

Clone this wiki locally