Updated on 2024-07-19 GMT+08:00

ALTER EXTERNAL SCHEMA

Function

Modifies EXTERNAL SCHEMA.

Only DWS 3.0 supports the ALTER EXTERNAL SCHEMA syntax.

Syntax

  • Modifies an external schema based on the specified name.
    1
    2
    3
    4
    5
    6
    ALTER EXTERNAL SCHEMA schema_name 
        WITH SOURCE source_type
        DATABASE 'db_name'
        SERVER srv_name
        METAADDRESS 'address'
        CONFIGURATION 'confpath';
    

Parameters

  • schema_name

    Name of an external schema.

    Value range: a string. It must comply with the naming convention.

    • The name must be unique,
    • and cannot start with pg_.
  • SOURCE

    Type of the external metadata storage engine. Currently, source_type can only be Hive.

  • DATABASE

    Hive database corresponding to the external schema.

    There is a many-to-one mapping between external schemas and Hive databases.

  • SERVER

    Value range: an existing foreign server.

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

  • METAADDRESS

    Hivemetastore communication interface.

  • CONFIGURATION

    Path for storing hivemetastore configuration files.

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.

Example

Modify the database and FOREIGN SERVER corresponding to ex1.

1
2
3
ALTER EXTERNAL SCHEMA ex1
    WITH DATABASE 'hms'
         SERVER obs_server;