In this section we will describes how to list out the tables of a particular database in MySQL database server using Sqoop. Sqoop list-tables tool parses and executes the ‘SHOW TABLES’ query against a particular database. Thereafter, it lists out the present tables in a database.
Syntax
The following syntax is used for Sqoop list-tables command.
$ sqoop list-tables (generic-args) (list-tables-args) $ sqoop-list-tables (generic-args) (list-tables-args)
Sample Query
The following command is used to list all the tables in the userdb database of MySQL database server.
$ sqoop list-tables \ --connect jdbc:mysql://localhost/userdb \ --username root
If the command is executes successfully, then it will display the list of tables in the userdb database as follows.
... 13/05/31 16:45:58 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset. emp emp_add emp_contact