SET CATALOG
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 |
|
|
Yes |
The target catalog name. This can be |
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 CATALOGtakes 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>.