我正在用 sql 编写 delta 实时表笔记本来访问数据湖中的文件,如下所示:
CREATE OR REFRESH STREAMING LIVE TABLE MyTable
AS SELECT * FROM cloud_files("DataLakeSource/MyTableFiles", "parquet", map("cloudFiles.inferColumnTypes", "true"))
每当我需要访问 Azure Data Lake 时,我通常会做这样的事情来设置访问:
service_credential = dbutils.secrets.get(scope="myscope",key="mykey")
spark.conf.set("fs.azure.account.auth.type.mylake.dfs.core.windows.net", "OAuth")
spark.conf.set("fs.azure.account.oauth.provider.type.mylake.dfs.core.windows.net", "org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider")
spark.conf.set("fs.azure.account.oauth2.client.id.MyLake.dfs.core.windows.net", "99999999-9999-9999-9999-999999999")
spark.conf.set("fs.azure.account.oauth2.client.secret.mylake.dfs.core.windows.net", service_credential)
spark.conf.set("fs.azure.account.oauth2.client.endpoint.mylake.dfs.core.windows.net", "https://login.microsoftonline.com/99999999-9999-9999-9999-9999999999/oauth2/token")
由于我无法像上面那样添加 python 单元以在 sql delta 实时表笔记本中设置访问权限,我如何/在哪里添加配置以访问数据湖文件?
我考虑过将配置信息添加到配置下的管道中,但这当然不适用于对 dbutils.secrets.get 的调用
可以单独创建一个notebook,里面有connection信息先调用,再调用SQL delta live table notebook