Prerequisites
External catalogs are created based on external data sources. For information about supported types of external catalogs, see Catalog.Procedure
-
Connect your cluster.
- If you use the MySQL client to connect the cluster, you go to
default_catalogby default after connecting. - If you use JDBC to connect the cluster, you can go directly to the destination database in the default catalog by specifying
default_catalog.db_namewhen connecting.
- If you use the MySQL client to connect the cluster, you go to
-
(Optional) Execute the following statement to view all the catalogs and find the external catalog you have created. See SHOW CATALOGS to check the output of this statement.
-
(Optional) Execute the following statement to view all the databases in the external catalog. See SHOW DATABASES to check the output of this statement.
-
(Optional) Execute the following statement to go to the destination database in the external catalog.
-
Query external data. For more usages of the SELECT statement, see SELECT.
If you do not specify the external catalog and database in the preceding steps, you can directly specify them in a select query.
Examples
If you already created a Hive catalog namedhive1 and want to use hive1 to query data from hive_db.hive_table of an Apache Hive™ cluster, you can perform one of the following operations: