我已成功将 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
中定义任何文件夹结构。代码。
思考表情符号
最佳答案
此处的解决方案是确保您使用共享访问签名 (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>
关于azure - 使用/mnt/将数据从 Azure Blob 存储读取到 Azure Databricks,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55189803/