ALTER SCHEMA (External Schema)
Overview
The ALTER SCHEMA statement is used to modify the properties of an existing schema, including renaming, modifying comments, and setting property key-value pairs. For external schemas, you can also update connection configurations by modifying properties.
Syntax
Parameter Description
| Parameter | Required | Description |
|---|---|---|
schema_name | Yes | Name of the schema to modify |
new_name | For RENAME only | New schema name, must be unique within the same workspace |
COMMENT 'new_comment' | No | New comment text, replaces the existing comment |
PROPERTIES (key = 'value') | No | Set custom schema properties as key-value pairs |
Examples
Example 1: Rename a Schema
Example 2: Modify Schema Comment
Verify after execution using DESC SCHEMA:
Sample output:
Example 3: Set Schema Properties
Example 4: Modify Connection Properties of an External Schema
After creating an external schema, you can update certain configurations by modifying PROPERTIES:
Notes
- External schemas do not support the
REFRESHoperation. Metadata changes in Hive Metastore (such as newly added tables) are automatically synchronized at query time without manual refresh. SET PROPERTIESis an incremental update; existing properties are not cleared, and only the specified keys are overwritten.- After renaming a schema, table names, views, and other objects referencing the schema are not automatically updated; dependencies must be checked manually.
Permission Requirements
The user executing ALTER SCHEMA must have ALTER permission on the corresponding schema.
