为三角洲湖配置存储凭证
砖三角洲湖表的数据存储在云存储对象。配置访问云对象存储需要权限内的云账户包含存储账户。看到在砖与外部数据。
通过存储凭证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 >”)。保存(“…”)