Updates an existing external location's URL, bound credential, options, owner, or comment.
ALTER EXTERNAL LOCATION <name>
[SET URL '<url>']
[SET STORAGE CREDENTIAL '<credential_name>']
[SET (<key> = '<value>', ...)]
[OWNER TO <new_owner>]
[COMMENT '<description>']
## Overview ALTER EXTERNAL LOCATION updates the configuration of an existing location in place. Use it to change the bound credential after a rotation, switch URLs after a bucket migration, or toggle the read-only flag. ## Behavior - The location must already exist; otherwise the ALTER raises an error. - When the bound credential is changed, the new credential must already exist. The executor validates this and rejects the statement if the credential is missing. - The `updated_at` timestamp advances on every successful ALTER. - Tables, schemas, or zones rooted at the location continue to resolve through the location's name; they pick up the new URL or credential automatically on the next storage operation. ## Access Control Requires the admin role. ## Compatibility DeltaForge extension.
| Name | Type | Description |
|---|---|---|
name | Specifies the external location to alter. Must already exist. | |
new_url | Specifies the new storage URL. | |
new_credential | Specifies the new bound storage credential. The credential must already exist; the executor validates this at ALTER time. | |
set_options | Specifies new option values. The reserved option `read_only = 'true' | 'false'` toggles the read-only flag. | |
new_owner | Specifies a new owner principal. | |
new_comment | Specifies a new description. |
-- Switch a location to a new credential after rotating the IAM role
ALTER EXTERNAL LOCATION raw_data SET STORAGE CREDENTIAL 'prod_aws_role_v2';
-- Change the URL after a bucket move
ALTER EXTERNAL LOCATION raw_data SET URL 's3://company-raw-eu/';
-- Toggle read-only
ALTER EXTERNAL LOCATION audit_archive SET (read_only = 'true');