我使用https://github.com/potix2/spark-google-spreadsheets庫來讀取spark中的電子表格文件。它在我的地方完美運作。Google Spread Sheet Spark庫
val df = sqlContext.read.
format("com.github.potix2.spark.google.spreadsheets").
option("serviceAccountId", "[email protected]").
option("credentialPath", "/path/to/credentail.p12").
load("<spreadsheetId>/worksheet1")
我創建了一個新的裝配jar包含所有憑據,並使用該jar讀取文件。但是我在閱讀credentialPath文件時遇到問題。我試過用
getClass.getResourceAsStream("/resources/Aircraft/allAircraft.txt")
但是庫只支持絕對路徑。請幫我解決這個問題。
這可能是因爲將證書放入jar中是一個相當糟糕的主意。通過ENV傳遞或單獨部署。 – Reactormonk
@Reactormonk,你可以提供一些建議//鏈接如何使用ENV。 thakns – John
可能相關:https://softwareengineering.stackexchange.com/questions/205606/strategy-for-keeping-secret-info-such-as-api-keys-out-of-source-control – Reactormonk