ALTER EXTERNAL LOCATION (Databricks SQL)

Preview

Unity Catalog is in Public Preview. To participate in the preview, contact your Databricks representative.

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 |
     ONNER TO principal }

Parameters

  • location_name

    Identifies the external location being altered.

  • RENAME TO to_location_name

    Renames the location a new name. 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.

  • OWNER TO principal

    Transfers ownership of the storage location to principal.

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 lcation
> ALTER EXTERNAL LOCATION best_loc OWNER TO `alf@melmak.et`