CREATE EXTERNAL LOCATION

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

Creates an external location with the specified name. If a location with the same name already exists, an exception is thrown.

Syntax

CREATE EXTERNAL LOCATION [ IF NOT EXISTS ] location_name
    URL url
    WITH ( [ STORAGE ] CREDENTIAL credential_name )
    [ COMMENT comment ]

Parameters

  • location_name

    The name of the location to be created.

  • IF NOT EXISTS

    Creates a location with the given name if it does not exist. If a location with the same name already exists, nothing will happen.

  • url

    A STRING literal with the location of the cloud storage described as an absolute URL.

  • credential_name

    The named credential used to connect to this location.

Examples

-- Create a location accessed using the gs_remote_cred credential
> CREATE EXTERNAL LOCATION gs_remote URL 'gs://us-east-1/location'
     WITH (STORAGE CREDENTIAL gs_remote_cred)
     COMMENT 'Default source for GCP exernal data';