CREATE EXTERNAL LOCATION
Applies to: Databricks SQL
Databricks Runtime 10.3 and above
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 |
[ ACCESS POINT access_point ] } )
[ COMMENT comment ]
Parameters
-
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.-
The named credential used to connect to this location.
access_point
Databricks Runtime 13.0 and above
access_point
must be a STRING literal with the Amazon S3 access point described in Amazon Resource Name (ARN) format and used to access the location of the cloud storage.comment
An optional description for the location, or
NULL
. The default isNULL
.
Examples
-- Create a location accessed using the s3_remote_cred credential
> CREATE EXTERNAL LOCATION s3_remote URL 's3://us-east-1/location'
WITH (STORAGE CREDENTIAL s3_remote_cred)
COMMENT 'Default source for AWS exernal data';
-- Creates an external location with the specified name with access point
> CREATE EXTERNAL LOCATION s3_remote URL 's3://us-east-1/location'
WITH (ACCESS POINT 'arn:aws:s3:us-east-1:123456789:accesspoint/remoteaccesspoint')
COMMENT 'Default source for AWS external data'