CREATE EXTERNAL VOLUME
Mounts external object storage (Alibaba Cloud OSS, Tencent Cloud COS, Amazon S3) and creates an External Volume object in Lakehouse.
Prerequisites
Before creating an External Volume, you need to create the corresponding Storage Connection:
Syntax
Parameters
| Parameter | Description |
|---|---|
IF NOT EXISTS | If the Volume already exists, skip without error |
schema_name | Name of the owning schema; current schema is used if omitted |
volume_name | Volume name, must be unique within the same schema |
LOCATION | Object storage path, format: oss://bucket_name/path/, cos://bucket_name/path/, s3://bucket_name/path/ |
USING CONNECTION | The Storage Connection name to reference |
DIRECTORY.enable | Whether to enable the directory feature; recommended to set to true |
DIRECTORY.auto_refresh | Whether to automatically refresh file metadata |
RECURSIVE | Whether to recursively scan subdirectories |
Examples
- Mount an Alibaba Cloud OSS bucket:
- Mount a Tencent Cloud COS bucket:
- Mount an Amazon S3 bucket:
- Create under a specific schema with
IF NOT EXISTS:
Notes
- External Volumes only store path metadata; actual data is stored in the external cloud storage, so there are no additional storage costs on the Lakehouse side
- Cross-cloud creation is not supported: Alibaba Cloud instances can only create OSS Connections, Tencent Cloud instances can only create COS Connections, etc.
- Deleting an External Volume does not delete the actual files in the external storage
Required Privileges
| Privilege | Description |
|---|---|
CREATE VOLUME | Create a Volume under the current schema |
