Reputation: 11
I am trying to create an external data source in SQL Server to an Azure Storage account. I have created the database scoped credential, but when I execute the CREATE EXTERNAL DATA SOURCE command, I get this:
Msg 105080, Level 16, State 1, Line 7
105080;CREATE EXTERNAL TABLE failed because the URI contains an unsupported path, fragment, user info, or query. Revise the URI and try again.
My create statement looks like this (obviously I have provided the correct container and account, just making it generic here for the sake of security):
CREATE EXTERNAL DATA SOURCE [Blob_CSV]
WITH
(
LOCATION = N'abs://scottpolybasestorage.blob.core.windows.net/polybase',
CREDENTIAL = [BlobStorageCredential]
)
So I am not sure why I am getting the error. I have essentially followed the instructions here:
Thanks in advance.
I have tried several iterations of the CREATE EXTERNAL DATA SOURCE statement, but according to teh documentation, what I have should work.
I have also tried:
CREATE EXTERNAL DATA SOURCE [Blob_CSV]
WITH
(
LOCATION = 'abs://[email protected]/',
CREDENTIAL = [BlobStorageCredential]
)
But same error.
Upvotes: 0
Views: 797
Reputation: 1090
I was receiving the same error with the same SQL Server version (2019) and started working after just adding the TYPE.
CREATE EXTERNAL DATA SOURCE [Blob_CSV]
WITH
(
LOCATION = 'abs://scottpolybasestorage.blob.core.windows.net/polybase',
CREDENTIAL = [BlobStorageCredential],
TYPE = BLOB_STORAGE 👈
)
Upvotes: 0
Reputation: 131
You need to read the documentation regarding SQL Server 2019: https://learn.microsoft.com/en-us/sql/relational-databases/polybase/polybase-configure-azure-blob-storage?view=sql-server-ver15
It states the code must be as follows:
-- LOCATION: Azure account storage account name and blob container name.
-- CREDENTIAL: The database scoped credential created above.
CREATE EXTERNAL DATA SOURCE AzureStorage with (
TYPE = HADOOP,
LOCATION ='wasbs://<blob_container_name>@<azure_storage_account_name>.blob.core.windows.net',
CREDENTIAL = AzureStorageCredential
);
For example, this works for me:
CREATE EXTERNAL DATA SOURCE [MyWASB] WITH (
TYPE=HADOOP,
LOCATION='wasb://[email protected]/',
CREDENTIAL=[AzureStorageCredential])
Upvotes: 0
Reputation: 5317
When creating an external data source for Blob storage in SQL server using the code below:
CREATE EXTERNAL DATA SOURCE
AzureStorageCred
WITH (
LOCATION = N'abs://<containerName>@<storageACCountName>.blob.core.windows.net/',
CREDENTIAL = AzureStorageCredential
);
I encountered the same error as shown below:
I initially used SQL Server 2019, but after updating to SQL Server 2022, I tried the same code to create an external data source. It executed successfully without any errors, as shown below:
Try using SQL Server 2022 version, and you should be able to create the data source.
Upvotes: 1