sqoop - Sqoop List Tables - apache sqoop - sqoop tutorial - sqoop hadoop
How to list tables in 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.
Purpose
List tables present in a database.
Syntax
$ sqoop list-tables (generic-args) (list-tables-args)
$ sqoop-list-tables (generic-args) (list-tables-args)
Click "Copy code" button to copy into clipboard - By wikitechy - sqoop tutorial - team
Common arguments
| Argument | Description |
|---|---|
| --connect <jdbc-uri> | Specify JDBC connect string |
| --connect-manager <jdbc-uri> | Specify connection manager class to use |
| --driver <class-name> | Manually specify JDBC driver class to use |
| --hadoop-home <dir> | Override $HADOOP_HOME |
| --help | Print usage instructions |
| -P | Read password from console |
| --password <password> | Set authentication password |
| --username <username> | Set authentication username |
| --verbose | Print more information while working |
| --connection-param-file <filename> | Optional properties file that provides connection parameters |
- List tables available in the "corp" database:
$ sqoop list-tables --connect jdbc:mysql://database.example.com/corp
employees
payroll_checks
job_descriptions
office_supplies
Click "Copy code" button to copy into clipboard - By wikitechy - sqoop tutorial - team
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
Click "Copy code" button to copy into clipboard - By wikitechy - sqoop tutorial - team
Output
- 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