本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
先決條件
-
您想要讀取的 Google SpreadSheet。您需要試算表的 SpreadSheet ID 和 tabName。
Google Sheets 實體和欄位詳細資訊:
實體 | 資料類型 | 支援的運算子 |
---|---|---|
試算表 | 字串 | 不適用 (不支援篩選條件) |
範例
googleSheets_read = glueContext.create_dynamic_frame.from_options(
connection_type="googlesheets",
connection_options={
"connectionName": "connectionName",
"ENTITY_NAME": "{SpreadSheetID}#{SheetTabName}",
"API_VERSION": "v4"
}
分割查詢
僅針對記錄基本分割區,如果您想要在 Spark 中使用並行,NUM_PARTITIONS
則可以提供做為額外的 Spark 選項。使用此參數,原始查詢會分割為可由 Spark 任務同時執行的子查詢NUM_PARTITIONS
數目。
使用 的範例 NUM_PARTITIONS
googlesheets_read = glueContext.create_dynamic_frame.from_options(
connection_type="googlesheets",
connection_options={
"connectionName": "connectionName",
"ENTITY_NAME": "{SpreadSheetID}#{SheetTabName}",
"API_VERSION": "v4",
"NUM_PARTITIONS": "10"
}