1408786user
1408786user

Reputation: 2014

SQL External blob table

I am trying to get access to my Azure blob storage via SQL. This (https://learn.microsoft.com/en-us/sql/t-sql/statements/create-external-table-transact-sql) article describes how it works.

I have tried the following SQL command:

-- PolyBase only: Azure Storage Blob as data source   
-- (on SQL Server 2016 and Azure SQL Data Warehouse)  
CREATE EXTERNAL DATA SOURCE dataSourceNameTestBlob  
    WITH (   
        TYPE = HADOOP,  
        LOCATION = 'wasb[s]://container@account_name.blob.core.windows.net'
        [, CREDENTIAL = credential_name ]
    )  
[;]

Which results in the following error:

Msg 102, Level 15, State 1, Line 5 Incorrect syntax near 'HADOOP'.

When I google on this error I find that I need to use sql DW (.dsql) instead of .sql queries. However the article mentions that I can use a Azure SQL Database.

What am I doing wrong? I just only want to access my blob storage in SQL.

Upvotes: 0

Views: 716

Answers (1)

EagleDev
EagleDev

Reputation: 1865

PolyBase scenario with Hadoop is only supported on SQL Server 2016 (or higher), Azure SQL Data Warehouse, and Parallel Data Warehouse.

Below is the T-SQL script against Azure SQL Database to store to blob storage.

CREATE EXTERNAL DATA SOURCE data_source_name  
    WITH (   
        TYPE = BLOB_STORAGE,  
        LOCATION = 'https://storage_account_name.blob.core.windows.net/container_name'
        [, CREDENTIAL = credential_name ]
    )  

Upvotes: 1

Related Questions