為三角洲湖配置存儲憑證
磚三角洲湖表的數據存儲在雲存儲對象。配置訪問雲對象存儲需要權限內的雲賬戶包含存儲賬戶。看到在磚與外部數據。
通過存儲憑證DataFrame選項
三角洲湖支持指定存儲憑證作為DataFrameReader和DataFrameWriter選項。您可以使用這個如果你需要與數據在多個存儲賬戶由不同的訪問鍵。
請注意
這個特性可以在磚運行時10.1及以上。
例如,您可以存儲credentails穿過DataFrame選項:
火花。相依。集(“google.cloud.auth.service.account.enable”,“真正的”)df1=火花。讀\。選項(“fs.gs.auth.service.account.email”,“< client-email-1 >”)\。選項(“fs.gs.project.id”,“< project-id-1 >”)\。選項(“fs.gs.auth.service.account.private.key”,“< private-key-1 >”)\。選項(“fs.gs.auth.service.account.private.key.id”,“< private-key-id-1 >”)\。讀(“…”)df2=火花。讀\。選項(“fs.gs.auth.service.account.email”,“< client-email-2 >”)\。選項(“fs.gs.project.id”,“< project-id-2 >”)\。選項(“fs.gs.auth.service.account.private.key”,“< private-key-2 >”)\。選項(“fs.gs.auth.service.account.private.key.id”,“< private-key-id-2 >”)\。讀(“…”)df1。聯盟(df2)。寫\。模式(“覆蓋”)\。選項(“fs.gs.auth.service.account.email”,“< client-email-3 >”)\。選項(“fs.gs.project.id”,“< project-id-3 >”)\。選項(“fs.gs.auth.service.account.private.key”,“< private-key-3 >”)\。選項(“fs.gs.auth.service.account.private.key.id”,“< private-key-id-3 >”)\。保存(“…”)
火花。相依。集(“google.cloud.auth.service.account.enable”,“真正的”)瓦爾df1=火花。讀。選項(“fs.gs.auth.service.account.email”,“< client-email-1 >”)。選項(“fs.gs.project.id”,“< project-id-1 >”)。選項(“fs.gs.auth.service.account.private.key”,“< private-key-1 >”)。選項(“fs.gs.auth.service.account.private.key.id”,“< private-key-id-1 >”)。讀(“…”)瓦爾df2=火花。讀。選項(“fs.gs.auth.service.account.email”,“< client-email-2 >”)。選項(“fs.gs.project.id”,“< project-id-2 >”)。選項(“fs.gs.auth.service.account.private.key”,“< private-key-2 >”)。選項(“fs.gs.auth.service.account.private.key.id”,“< private-key-id-2 >”)。讀(“…”)df1。聯盟(df2)。寫。模式(“覆蓋”)。選項(“fs.gs.auth.service.account.email”,“< client-email-3 >”)。選項(“fs.gs.project.id”,“< project-id-3 >”)。選項(“fs.gs.auth.service.account.private.key”,“< private-key-3 >”)。選項(“fs.gs.auth.service.account.private.key.id”,“< private-key-id-3 >”)。保存(“…”)