在 Databricks 上使用 Pyspark 访问 Azure ADLS gen2
Accessing Azure ADLS gen2 with Pyspark on Databricks
我正在尝试学习 Spark、Databricks 和 Azure。
我正在尝试使用 Pyspark 从 Databricks 访问 GEN2。
我找不到合适的方法,我认为它非常简单但我失败了。
目前我每次收到以下信息:
Unable to access container {name} in account {name} using anonymous
credentials, and no credentials found for them in the configuration.
我已经 运行 GEN2 + 我有一个 SAS_URI 可以访问。
到目前为止我正在尝试的是:
(基于此 link:https://docs.microsoft.com/pl-pl/azure/databricks/data/data-sources/azure/adls-gen2/azure-datalake-gen2-sas-access):
spark.conf.set(f"fs.azure.account.auth.type.{STORAGE_ACCOUNT_NAME}.dfs.core.windows.net", {SAS_URI})
spark.conf.set(f"fs.azure.sas.token.provider.type.{STORAGE_ACCOUNT_NAME}.dfs.core.windows.net", {SAS_URI})
然后联系数据:
sd_xxx = spark.read.parquet(f"wasbs://{CONTAINER_NAME}@{STORAGE_ACCOUNT_NAME}.dfs.core.windows.net/{proper_path_to_files/}")
您的配置不正确。第一个参数应该设置为 SAS
值,而第二个参数 - Scala/Java class 的名称将 return SAS 令牌 - 你不能只使用 URI里面有SAS信息,需要自己实现一些自定义代码。
如果你想使用wasbs
访问Azure Blog Storage的协议,虽然它可以用来访问ADLS Gen2(虽然不推荐),但你需要使用blob.core.windows.net
而不是 dfs.core.windows.net
,并设置 correct spark property for Azure Blob access.
更常见的程序如下:Access Azure Data Lake Storage Gen2 using OAuth 2.0 with an Azure service principal
我正在尝试学习 Spark、Databricks 和 Azure。
我正在尝试使用 Pyspark 从 Databricks 访问 GEN2。 我找不到合适的方法,我认为它非常简单但我失败了。
目前我每次收到以下信息:
Unable to access container {name} in account {name} using anonymous
credentials, and no credentials found for them in the configuration.
我已经 运行 GEN2 + 我有一个 SAS_URI 可以访问。
到目前为止我正在尝试的是: (基于此 link:https://docs.microsoft.com/pl-pl/azure/databricks/data/data-sources/azure/adls-gen2/azure-datalake-gen2-sas-access):
spark.conf.set(f"fs.azure.account.auth.type.{STORAGE_ACCOUNT_NAME}.dfs.core.windows.net", {SAS_URI})
spark.conf.set(f"fs.azure.sas.token.provider.type.{STORAGE_ACCOUNT_NAME}.dfs.core.windows.net", {SAS_URI})
然后联系数据:
sd_xxx = spark.read.parquet(f"wasbs://{CONTAINER_NAME}@{STORAGE_ACCOUNT_NAME}.dfs.core.windows.net/{proper_path_to_files/}")
您的配置不正确。第一个参数应该设置为 SAS
值,而第二个参数 - Scala/Java class 的名称将 return SAS 令牌 - 你不能只使用 URI里面有SAS信息,需要自己实现一些自定义代码。
如果你想使用wasbs
访问Azure Blog Storage的协议,虽然它可以用来访问ADLS Gen2(虽然不推荐),但你需要使用blob.core.windows.net
而不是 dfs.core.windows.net
,并设置 correct spark property for Azure Blob access.
更常见的程序如下:Access Azure Data Lake Storage Gen2 using OAuth 2.0 with an Azure service principal