Sqoop List-Tables Command With Example

Sqoop List-Tables Command With Example

This post 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.

Step 1 - Change the directory to /usr/local/hadoop/sbin

$ cd /usr/local/hadoop/sbin

Step 2 - Start all hadoop daemons.

$ start-all.sh

Step 3 - The JPS (Java Virtual Machine Process Status Tool) tool is limited to reporting information on JVMs for which it has the access permissions.

$ jps

Step 4 - Change the directory to /usr/local/sqoop/bin

$ cd /usr/local/sqoop/bin


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 \
--password root 

You can also list-tables using eval command.

$ sqoop eval \
--connect jdbc:mysql://localhost/userdb \
--username root \
--password root \
--query "show tables"

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *