SET CATALOG

更新时间:
复制 MD 格式

SET CATALOG switches the active catalog for the current session. After the switch, subsequent SQL statements are executed in the target catalog by default.

Syntax

SET CATALOG <catalog_name>;

Parameters

Parameter

Required

Description

catalog_name

Yes

The target catalog name. This can be adb (the Managed Catalog) or the name of any existing External Catalog.

Examples

Switch the active catalog for the current session to the Hive Catalog hive_metastore:

SET CATALOG hive_metastore;

Switch the active catalog for the current session back to the Managed Catalog adb:

SET CATALOG adb;

Usage notes

  • This command is supported since AnalyticDB for MySQL 3.2.7.

  • SET CATALOG takes effect only for the current session and does not affect other connections.

  • After switching catalogs, the active database is reset. To switch both the catalog and the database at once, use USE <catalog_name>.<database_name>.

  • Regardless of the active catalog, you can always query across catalogs using the three-part name <catalog>.<database>.<table>.

Related documents