【问题标题】:Reading data from Azure Blob Storage into Azure Databricks using /mnt/使用 /mnt/ 将数据从 Azure Blob 存储读取到 Azure Databricks
【发布时间】:2019-08-06 23:00:03
【问题描述】:

我已成功将 Blob 存储挂载到 Databricks,并且在运行 dbutils.fs.ls("/mnt/") 时可以看到定义的挂载点。这有size=0 - 不清楚这是否是预期的。

当我尝试运行 dbutils.fs.ls("/mnt/<mount-name>") 时,我收到以下错误: java.io.FileNotFoundException: / is not found

当我尝试使用 dbutils.fs.put("/mnt/<mount-name>/1.txt", "Hello, World!", True) 将简单文件写入已安装的 blob 时,我收到以下错误(为便于阅读而缩短):

ExecutionError: An error occurred while calling z:com.databricks.backend.daemon.dbutils.FSUtils.put. : shaded.databricks.org.apache.hadoop.fs.azure.AzureException: java.util.NoSuchElementException: An error occurred while enumerating the result, check the original exception for details.
...
Caused by: com.microsoft.azure.storage.StorageException: The specified resource does not exist.

所有数据都在 Blob 容器的根目录下,所以我没有在 dbutils.fs.mount 代码中定义任何文件夹结构。

思考的表情符号

【问题讨论】:

    标签: azure pyspark databricks azure-databricks


    【解决方案1】:

    这里的解决方案是确保您使用的是共享访问签名 (SAS) 的“正确”部分。生成 SAS 后,您会发现它有很多不同的部分可供您使用 - 它可能作为一个长连接字符串发送给您,例如:

    BlobEndpoint=https://<storage-account>.blob.core.windows.net/;QueueEndpoint=https://<storage-account>.queue.core.windows.net/;FileEndpoint=https://<storage-account>.file.core.windows.net/;TableEndpoint=https://<storage-account>.table.core.windows.net/;SharedAccessSignature=sv=<date>&ss=nwrt&srt=sco&sp=rsdgrtp&se=<datetime>&st=<datetime>&spr=https&sig=<long-string>
    

    定义挂载点时,使用SharedAccessSignature 键的值,例如:

    sv=<date>&ss=nwrt&srt=sco&sp=rsdgrtp&se=<datetime>&st=<datetime>&spr=https&sig=<long-string>
    

    【讨论】:

    • 这也对我有用,我使用的是连接字符串,但切换到 SAS 令牌并从一开始就删除了 ?
    猜你喜欢
    • 2020-11-15
    • 2021-07-11
    • 2022-01-19
    • 2020-03-15
    • 2021-02-22
    • 2019-08-04
    • 1970-01-01
    • 2012-06-16
    • 2019-06-09
    相关资源
    最近更新 更多