您目前查看的是 Apigee Edge 說明文件。
前往 Apigee X 說明文件。 info
2.0.1 版
將資料列插入 BigQuery 資料表。列出資料表中的資料列。
必要條件
這項內容提供設定及使用這項擴充功能的參考資料。使用 ExtensionCallout 政策從 API Proxy 使用擴充功能之前,請務必完成下列步驟:
確認您已為帳戶啟用 BigQuery API。
關於 Google BigQuery
Google BigQuery 是無伺服器且可擴充的企業資料倉儲,能夠利用 Google 基礎架構的強大處理能力,以超高效率執行 SQL 查詢。由於不必管理基礎架構,更不需要資料庫管理員,BigQuery 讓你可以專心分析資料,使用熟悉的 SQL,找出有意義的深入分析結果。
如需實作簡介,請嘗試其中一個 Google BigQuery 快速入門導覽課程。
動作
insert
將一組記錄以資料集的形式直接插入 BigQuery,並提供要插入的資料列和資料集/資料表 ID。
語法
<Action>insert</Action>
<Input><![CDATA[{
"dataset" : dataset-to-insert,
"table" : table-to-receive-data,
"rows" : array-of-rows-to-insert
}]]></Input>
範例
<Action>insert</Action>
<Input><![CDATA[{
"dataset" : "TestData",
"table" : "TestTable",
"rows" : [
{"technology":"CRISPR","inventorFirstName":"Jennifer","inventorLastName":"Doudna"},
{"technology":"World Wide Web","inventorFirstName":"Tim","inventorLastName":"Berners-Lee"}
{"technology":"Alternating current","inventorFirstName":"Nikola","inventorLastName":"Tesla"}
]
}]]></Input>
要求參數
參數 | 說明 | 類型 | 預設 | 必填 |
---|---|---|---|---|
資料集 | 要插入 BigQuery 的資料集 ID。 | 字串 | 無。 | 是。 |
列 | 要插入表格的資料列。 | 陣列 | 無。 | 是。 |
資料表 | 接收資料的資料表名稱。 | 字串 | 無。 | 是。 |
回應
無。
listRows
列出資料表 ID 和資料集 ID 指定的資料表中的資料列。
語法
<Action>listRows</Action>
<Input><![CDATA[{
"dataset" : ID-of-dataset-to-examine,
"limit" : maximum-rows-to-list,
"startIndex" : row-index-at-which-to-start-list
"table" : ID-of-table-to-examine
}]]></Input>
範例
<Action>listRows</Action>
<Input><![CDATA[{
"dataset" : "TestData",
"limit" : 2,
"startIndex" : 1,
"table" : "TestTable"
}]]></Input>
要求參數
參數 | 說明 | 類型 | 預設 | 必填 |
---|---|---|---|---|
資料集 | 要列出資料列的資料集 ID。 | 字串 | 無。 | 是。 |
限制 | 要列出的資料列數量上限。 | 整數 | 無。 | 不用 |
startIndex | 清單的起始列索引。 | 整數 | 無。 | 不用 |
資料表 | 要列出資料列的資料表 ID。 | 字串 | 無。 | 是。 |
回應
rows
陣列。
{
"rows": [
{"technology":"World Wide Web","inventorFirstName":"Tim","inventorLastName":"Berners-Lee"}
{"technology":"Alternating current","inventorFirstName":"Nikola","inventorLastName":"Tesla"}
]
}
參數 | 說明 | 類型 | 預設 | 必填 |
---|---|---|---|---|
列 | 要求傳回的資料列陣列。 | 陣列 | 無。 | 是。 |
設定參考資料
設定及部署這個擴充功能,以便在 API Proxy 中使用時,請參考下列說明。如要瞭解如何使用 Apigee 控制台設定擴充功能,請參閱「新增及設定擴充功能」。
常見的擴充功能屬性
每個擴充功能都有下列屬性。
屬性 | 說明 | 預設 | 必要 |
---|---|---|---|
name |
您要為這項擴充功能設定的名稱。 | 無 | 相容 |
packageName |
Apigee Edge 指定的擴充功能套件名稱。 | 無 | 相容 |
version |
擴充功能的擴充功能套件版本號碼。 | 無 | 相容 |
configuration |
您要新增的擴充功能專屬的設定值。請參閱「這個擴充功能套件的屬性」一文 | 無 | 相容 |
這個擴充套件的屬性
指定下列這項擴充功能專用的設定屬性值。
屬性 | 說明 | 預設 | 必填 |
---|---|---|---|
專案 ID | 資料所在的 GCP 專案 ID。 | 無。 | 是。 |
憑證 | 在 Apigee Edge 控制台中輸入時,這是服務帳戶金鑰檔案的內容。透過 Management API 傳送時,這是從服務帳戶金鑰檔案產生的 Base64 編碼值。 | 無。 | 是。 |