Updated on 2025-07-22 GMT+08:00

ALTER EXTERNAL SCHEMA

Function

Modifies EXTERNAL SCHEMA. This syntax is supported only in 8.3.0 and later versions.

Syntax

Modify an external schema based on the specified name.
1
2
3
4
5
6
7
8
ALTER EXTERNAL SCHEMA schema_name 
    WITH [ SOURCE source_name ]
         [ DATABASE 'database_name' ]
         [ SERVER server_name ]
         [ CATALOG 'catalog_name' ]
         [ OPTIONS ( { option_name ' value ' } [, ...] ) ]
         [ METAADDRESS 'address']
         [ CONFIGURATION 'confpath'];

Parameter Description

Table 1 ALTER EXTERNAL SCHEMA parameters

Parameter

Description

Value Range

schema_name

Specifies the name of the external schema to be modified.

Name of an existing schema.

SOURCE

Specifies the type of the external metadata storage engine.

source_type can only be dli, lakeformation, or hive.

DATABASE

Specifies the database to be accessed by the external schema.

-

SERVER

You can associate an external schema with a foreign server to access external data.

An existing foreign server whose type is lf, dli, obs, or hdfs.

CATALOG

Catalog to be accessed in LakeFormation.

-

OPTIONS

Specifies parameters of foreign table data. This is supported only by 8.3.0 and later versions.

dli_project_id: project ID of DLI. You can obtain the project ID from the management console. This parameter can be set only when the server type is DLI.

METAADDRESS

Specifies the Hive Metastore communication port. This is supported only by 9.1.0 and later versions.

-

CONFIGURATION

Specifies the path for storing Hive Metastore configuration files. This parameter is supported only by clusters of version 9.1.0 or later.

If objects in the schema on the current search path are with the same name, specify the schemas different objects are in. You can run the SHOW SEARCH_PATH command to check the schemas on the current search path.

-

Examples

Modify the database and FOREIGN SERVER corresponding to the EXTERNAL SCHEMA whose name is ex1.

1
2
3
ALTER EXTERNAL SCHEMA ex1
    WITH DATABASE 'demo'
         SERVER my_server;