简体   繁体   English

无法创建从 Azure Blob 存储容器到 Azure Sql 数据库超大规模的外部数据源

[英]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我已将单个文件 (BlockBlob) 上传到 Azure BlobStorage 中的容器

This is the path: https://myStorageName.blob.core.windows.net/myContainerName/myFolder.Name/myFileName.json这是路径: https : //myStorageName.blob.core.windows.net/myContainerName/myFolder.Name/myFileName.json

I want to load this file into a table within Azure Sql Database我想将此文件加载到 Azure Sql 数据库中的表中

If I create a SAS to the file, things works perfectly.如果我为该文件创建一个 SAS,则一切正常。 However I am failing to generate a single SAS that can access multiple files inside a container.但是,我无法生成可以访问容器内多个文件的单个 SAS。

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:如果我生成一个具有所有权限的 SAS (SECRET = '?sv=......'),它将不起作用:

生成存储 SAS

Should I use something different?我应该使用不同的东西吗? Does it even works?它甚至有效吗?

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 .如果在页面上向上滚动,“适用于”不会调用突触/SQL DW。 Are you sure that you are using Synapse ?你确定你在使用 Synapse 吗? BULK INERT is not supported in SQL pool . SQL 池中不支持 BULK INERT。

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 .无论如何,如果您通常使用 Synapse,我们可以使用 COPY INTO 命令,但在您的情况下,我们有不支持的 JSON 格式。 I think you can use Azure datafactory我认为您可以使用 Azure 数据工厂

This document says:这份文件说:

Warning警告

The SAS key value might begin with a '?' SAS 键值可能以“?”开头(question mark). (问号)。 When you use the SAS key, you must remove the leading '?'.使用 SAS 键时,必须删除前导的“?”。 Otherwise your efforts might be blocked.否则你的努力可能会被阻止。

I notice in your working code there is no '?'我注意到在您的工作代码中没有“?” but there is in your SAS token which doesn't work.但是您的 SAS 令牌中存在不起作用。 Can you double check this small difference isn't the problem?你能仔细检查一下这个微小的差异是不是问题所在?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM