'Can't create an external data source from Azure Blob Storage Container to Azure Sql Database Hyperscale
I have uploaded a single file (BlockBlob) to a container in the Azure BlobStorage
This is the path: https://myStorageName.blob.core.windows.net/myContainerName/myFolder.Name/myFileName.json
I want to load this file into a table within Azure Sql Database
If I create a SAS to the file, things works perfectly. However I am failing to generate a single SAS that can access multiple files inside a container.
Here is the code that works:
CREATE DATABASE SCOPED CREDENTIAL TemporaryBlobSCredential
WITH IDENTITY = 'SHARED ACCESS SIGNATURE',
SECRET = 'sp=......................'
CREATE EXTERNAL DATA SOURCE TemporaryBlobDataSource
WITH ( TYPE = BLOB_STORAGE,
LOCATION = 'https://<myStorageName>.blob.core.windows.net/<myContainerName>',
CREDENTIAL= TemporaryBlobSCredential);
create table <tableName>
(JsonData varchar(max))
BULK INSERT <tableName>
FROM '<myFolder.Name>/<myFileName>.json'
WITH (DATA_SOURCE = 'TemporaryBlobDataSource');
If I generate a SAS that has ALL the permissions (SECRET = '?sv=......') it won't work:
Should I use something different? Does it even works?
Solution 1:[1]
I just tried to run the code which you shared and it is very similar to what is pasted here . if you scroll up on the page , the "Applies to" does not call out synapse / SQL DW . Are you sure that you are using Synapse ? BULK INERT is not supported in SQL pool .
Anyways if you are using Synapse generally we can use the COPY INTO command but in your case we have JSON format which is not support . I think you can use Azure datafactory
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | HimanshuSinha-msft |

