從 Google Sheets 實體中讀取 - AWS Glue

從 Google Sheets 實體中讀取

先決條件

  • 您要從中讀取的 Google SpreadSheet。您將需要試算表的 SpreadSheet ID 和 tabName。

Google Sheets 實體和欄位詳細資訊:

實體 資料類型 支援的運算子
試算表 String 不適用 (不支援篩選條件)

範例

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" }