azure - 使用/mnt/将数据从 Azure Blob 存储读取到 Azure Databricks

标签 azure pyspark databricks azure-databricks

我已成功将 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/

相关文章:

c# - azure Blob 和缩略图

java - 使用 DataFrameReader 从 S3 读取文件

azure - 无法将 Databricks Repo 推送到 GitHub 存储库

apache-spark - 即使不坚持,Spark 内存缓存也会不断增加

apache-spark - 将 Spark 数据帧写入单个 Parquet 文件

python - 通过 Okta 身份验证使用 Databricks Snowflake 连接器连接到 Snowflake

java - Maven 测试在 Azure DevOps 中失败。 java.io.FileNotFoundException : TestSuiteList. xls(没有这样的文件或目录)

azure - 如何将 Azure 逻辑应用中 For_Each 循环的输出合并到单个平面数组?

Azure 服务总线 - 确定事件连接数(主题/队列)

dataframe - 删除 pyspark 数据框中的空格