ALTER EXTERNAL LOCATION

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 10.3 and above

Alters properties of an external location or renames the location.

Syntax

ALTER EXTERNAL LOCATION location_name
   { RENAME TO to_location_name |
     SET URL url [ FORCE ] |
     SET STORAGE CREDENTIAL credential_name |
     [ SET ] OWNER TO principal }

Parameters

  • location_name

    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 [ FORCE ]

    url must be a STRING 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: check marked yes Databricks SQL SQL warehouse version 2022.35 or higher check marked yes Databricks Runtime 11.2 and above

    SET is allowed as an optional keyword.

Examples

-- 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 `s3::/us-east-1-prod/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`