ALTER EXTERNAL LOCATION
Applies to: Databricks SQL Databricks Runtime 10.4 LTS and above Unity Catalog only
Alters properties of an external location or renames the location.
Syntax
ALTER EXTERNAL LOCATION location_name
{ RENAME TO to_location_name |
SET URL url_str [ FORCE ] |
SET STORAGE CREDENTIAL credential_name |
[ SET ] OWNER TO principal }
Any object name that includes special characters, such as hyphens (-
), must be surrounded by backticks (` `
). Object names with underscores (_
) don't require backticks. See Names and Examples.
Parameters
-
Identifies the external location being altered.
RENAME TO to_location_name
Renames the location. The name must be unique among all locations in the metastore.
SET URL url_str [ FORCE ]
url_str
must be aSTRING
literal with the location of the cloud storage described as an absolute URL.Unless you specify
FORCE
the statement will fail if the location is currently in use.SET STORAGE CREDENTIAL credential_name
Updates the named credential used to access this location. If the credential does not exist Databricks SQL raises an error.
[ SET ] OWNER TO principal
Transfers ownership of the storage location to
principal
.Applies to: Databricks SQL Databricks Runtime 11.3 LTS and above
SET
is allowed as an optional keyword.
Examples
The following examples use location names that don't include special characters, such as hyphens (-
). Any object name that includes special characters must be surrounded by backticks (` `
). See Names.
-- Rename a location
> ALTER EXTERNAL LOCATION descend_loc RENAME TO decent_loc;
-- Redirect the URL associated with the location
> ALTER EXTERNAL LOCATION best_loc SET URL 'abfss://container@storageaccount.dfs.core.chinacloudapi.cn/best_location' FORCE;
-- Change the credentials used to access the location
> ALTER EXTERNAL LOCATION best_loc SET STORAGE CREDENTIAL street_cred;
-- Change ownership of the external location
> ALTER EXTERNAL LOCATION best_loc OWNER TO `alf@melmak.et`