In Hologres V3.0 and later, you can create an external schema in an external database whose data source is DLF 2.0. An external schema in Hologres corresponds to a database in DLF 2.0. After you execute the CREATE EXTERNAL SCHEMA statement to create an external schema, a database that has the same name as the external schema is created in the catalog of DLF 2.0. This topic describes how to create an external schema in Hologres.
Limits
If you want to execute this statement to create an external schema, you must be granted superuser permissions or the CREATE permission on the database in which the external schema resides.
You cannot create an external schema in an external database whose data source is DLF 1.0 or MaxCompute.
Syntax
CREATE EXTERNAL SCHEMA [IF NOT EXISTS] <EXT_DB_NAME>.<EXT_SCHEMA_NAME>;
Example
-- DLF2.0 data source
CREATE EXTERNAL SCHEMA IF NOT EXISTS ext_db_dlf.ext_dlf_db;
Other operations
Query all external schemas in an external database
SELECT * FROM hologres.hg_external_schemas('<EXT_DB_NAME>');
Refresh metadata
REFRESH CACHE FOR External Schema <EXT_DB_NAME>.<EXT_SCHEMA_NAME> WITH( cache_level = 'metadata');