Creates an external schema in Hologres that maps to a database in a Data Lake Formation (DLF) 2.0 catalog. After the command runs, a database with the same name is created in the DLF 2.0 catalog.
Prerequisites
Before you run this command, make sure that you have:
A Hologres instance running V3.0 or later
Superuser privileges, or the CREATE permission on the Hologres database
Syntax
CREATE EXTERNAL SCHEMA [IF NOT EXISTS] <EXT_DB_NAME>.<EXT_SCHEMA_NAME>;Parameters
| Parameter | Description |
|---|---|
IF NOT EXISTS | Prevents an error if the external schema already exists. Use this clause in scripts to avoid failures on re-runs. |
EXT_DB_NAME | The name of the external database in Hologres that uses DLF 2.0 as its data source. |
EXT_SCHEMA_NAME | The name of the external schema to create. A database with this name is created in the DLF 2.0 catalog. |
Limitations
The data source of the external database must be DLF 2.0. External databases backed by DLF 1.0 or MaxCompute are not supported.
Example
-- Create an external schema in the DLF 2.0-backed external database ext_db_dlf
CREATE EXTERNAL SCHEMA IF NOT EXISTS ext_db_dlf.ext_dlf_db;More operations
List all external schemas in an external database
SELECT * FROM hologres.hg_external_schemas('<EXT_DB_NAME>');Refresh schema metadata
REFRESH CACHE FOR External Schema <EXT_DB_NAME>.<EXT_SCHEMA_NAME> WITH (cache_level = 'metadata');