Sqoop 简明教程

Sqoop - List Tables

本章介绍如何使用 Sqoop 在 MySQL 数据库服务器中列出特定数据库中的表。Sqoop list-tables 工具解析并针对特定数据库执行“SHOW TABLES”查询。然后它列出数据库中存在的表。

This chapter 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

以下语法用于 Sqoop list-tables 命令。

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

以下命令用于列出 MySQL 数据库服务器的 userdb 数据库中的所有表。

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

如果命令执行成功,它将如下显示 userdb 数据库中的表列表。

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