SQL Server 2019 PolyBase - CREATE EXTERNAL DATA SOURCE returns unsupported URI

o2rvlv0m  于 2023-10-15  发布在  SQL Server
关注(0)|答案(2)|浏览(122)

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:

https://learn.microsoft.com/en-us/sql/relational-databases/polybase/virtualize-csv?view=sql-server-ver16

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.

roqulrg3

roqulrg31#

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.

qaxu7uf2

qaxu7uf22#

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])

相关问题