databricks - Databrick 连接到 ADLS Gen2 文本文件
问题描述
我正在使用数据块来访问我的 ADLS Gen2 容器。
dbutils.fs.mount(
source = "wasbs://<container-name>@<storage-account-name>.blob.core.windows.net",
mount_point = "/mnt/<mount-name>",
extra_configs = {"<conf-key>":dbutils.secrets.get(scope = "<scope-name>", key = "<key-name>")})
我正在使用以下代码并更改我需要更改的内容。
当我运行脚本时,出现以下错误
df = spark.read.text("/mnt/<mount-name>/...")
shaded.databricks.org.apache.hadoop.fs.azure.AzureException: shaded.databricks.org.apache.hadoop.fs.azure.AzureException: Container <container name> in account <storage account name>.blob.core.windows.net not found, and we can't create it using anoynomous credentials, and no credentials found for them in the configuration.
我在我的应用程序注册中注册了数据块,并将名称添加到我的 ADLS 角色中作为存储 Blob 数据贡献者。
我不确定为什么我的凭据不允许我提取我的 ADLS 帐户中的文本文件。
任何帮助表示赞赏!
解决方案
我试图重现这个问题,它对我来说工作正常。我跟着这个教程。
请在下面找到 databrick 笔记本片段:
您可以考虑相同的代码示例。如下请见:
configs = {"fs.azure.account.auth.type": "OAuth",
"fs.azure.account.oauth.provider.type": "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider",
"fs.azure.account.oauth2.client.id": "<appId>",
"fs.azure.account.oauth2.client.secret": "<clientSecret>",
"fs.azure.account.oauth2.client.endpoint": "https://login.microsoftonline.com/<tenant>/oauth2/token",
"fs.azure.createRemoteFileSystemDuringInitialization": "true"}
dbutils.fs.mount(
source = "abfss://<container-name>@<storage-account-name>.dfs.core.windows.net/folder1",
mount_point = "/mnt/flightdata",
extra_configs = configs)
在此代码块中,将此代码块中的appId、clientSecret、tenant和storage-account-name占位符值替换为您在完成先决条件时收集的值。将container-name占位符值替换为容器的名称。
请考虑以下几点:
- 确保您的容器和存储帐户名称正确。
- 必须完成教程页面中提到的所有先决条件。用户拥有所有必需的权限。
推荐阅读
- javascript - 如何为具有 2 个网页的产品编写赛普拉斯测试?
- javascript - 浏览器如何处理包含内联事件处理程序的废弃/销毁页面元素
- kubernetes - 如何为在 GKE 上运行的 Kubernetes 服务定义服务标签
- node.js - 通过 API 网关调用 NodeJS lambda 函数时出现服务器错误
- ios - 如何从 Xamarin iOS Google Maps 上的字符串值创建制造商
- deno - 如何在 Deno 中调试 OOM 崩溃
- graph - 你能像我们在 Neo4J 图中那样在 Gremlin Tinkerpop 中为一个顶点设置多个标签吗?
- c++ - 从函数返回 lambda 表达式的返回值有什么意义?
- rust - 通过重载运算符来为 Any 生锈管道运算符
- c# - 我们如何创建一个 IObservableList
来自 IObservable >?