使用 Azure Data Factory 或 Synapse Analytics,從 Google BigQuery 複製資料
適用於:Azure Data Factory Azure Synapse Analytics
提示
試用 Microsoft Fabric 中的 Data Factory,這是適用於企業的全方位分析解決方案。 Microsoft Fabric 涵蓋從資料移動到資料科學、即時分析、商業智慧和報告的所有項目。 了解如何免費開始新的試用!
本文概述如何使用 Azure Data Factory 和 Synapse Analytics 管線中的複製活動,從 Google BigQuery 複製資料。 本文是根據複製活動概觀一文,該文提供複製活動的一般概觀。
重要
新的Google BigQuery連接器提供改良的原生Google BigQuery支援。 如果您在解決方案中使用舊版 Google BigQuery 連接器,請在 2024 年 10 月 31 日之前升級 Google BigQuery 連接器。 如需舊版與最新版本差異的詳細數據,請參閱本節。
支援的功能
此 Google BigQuery 連接器支援下列功能:
支援的功能 | IR |
---|---|
複製活動 (來源/-) | (1) (2) |
查閱活動 | (1) (2) |
① Azure 整合執行階段 ② 自我裝載整合執行階段
如需複製活動所支援作為來源或接收器的資料存放區清單,請參閱支援的資料存放區表格。
該服務會提供內建的驅動程式來啟用連線。 因此,您不需要為了使用此連接器而需手動安裝驅動程式。
注意
這個 Google BigQuery 連接器會建置於 BigQuery API 之上。 請注意,BigQuery 會限制傳入要求的速率上限,並根據每個專案強制執行適當的配額,請參閱配額與限制 - API 要求 \(英文\)。 請確定您不會觸發太多對帳戶的並行要求。
開始使用
若要透過管線執行複製活動,您可以使用下列其中一個工具或 SDK:
使用 UI 建立連結至 Google BigQuery 的服務
使用下列步驟,在 Azure 入口網站 UI 中建立連結至 Google BigQuery 的服務。
前往 Azure Data Factory 或 Synapse 工作區的 [管理] 索引標籤,選取 [連結服務],然後按一下 [新增]:
搜尋 Google BigQuery 並選取連接器。
設定服務詳細資料,測試連線,然後建立新的連結服務。
連接器設定詳細資料
下列各節提供屬性的相關詳細資料,這些屬性是用來定義 Google BigQuery 連接器專屬的實體。
連結服務屬性
以下是針對 Google BigQuery 連結服務所支援的屬性。
屬性 | 描述 | 必要 |
---|---|---|
type | type 屬性必須設定為 GoogleBigQueryV2。 | Yes |
projectId | 要據以查詢之預設 BigQuery 專案的專案識別碼。 | Yes |
authenticationType | 用於驗證的 OAuth 2.0 驗證機制。 允許的值為 UserAuthentication 和 ServiceAuthentication。 請分別參閱此關於更多屬性的下列資料表各節以及這些驗證類型的 JSON 範例。 |
Yes |
使用使用者驗證
將 "authenticationType" 屬性設定為 [UserAuthentication],並連同上一節所述的一般屬性指定下列屬性:
屬性 | 描述 | 必要 |
---|---|---|
clientId | 用來產生重新整理權杖之應用程式的識別碼。 | Yes |
clientSecret | 用來產生重新整理權杖之應用程式的祕密。 將此欄位標記為 SecureString 以便安全儲存,或參考 Azure Key Vault 中儲存的祕密。 | Yes |
refreshToken | 從 Google 取得的重新整理權杖,用來授權存取 BigQuery。 了解如何從取得 OAuth 2.0 存取權杖 \(英文\) 和這個社群部落格 \(英文\) 取得權杖。 將此欄位標記為 SecureString 以便安全儲存,或參考 Azure Key Vault 中儲存的祕密。 | Yes |
範例:
{
"name": "GoogleBigQueryLinkedService",
"properties": {
"type": "GoogleBigQueryV2",
"typeProperties": {
"projectId" : "<project ID>",
"authenticationType" : "UserAuthentication",
"clientId": "<client ID>",
"clientSecret": {
"type": "SecureString",
"value":"<client secret>"
},
"refreshToken": {
"type": "SecureString",
"value": "<refresh token>"
}
}
}
}
使用服務驗證
將 "authenticationType" 屬性設定為 [ServiceAuthentication],並連同上一節所述的一般屬性指定下列屬性。
屬性 | 描述 | 必要 |
---|---|---|
keyFileContent | JSON 格式的金鑰檔案,用來驗證服務帳戶。 將此欄位標記為 SecureString 以便安全儲存,或參考 Azure Key Vault 中儲存的祕密。 | Yes |
範例:
{
"name": "GoogleBigQueryLinkedService",
"properties": {
"type": "GoogleBigQueryV2",
"typeProperties": {
"projectId": "<project ID>",
"authenticationType": "ServiceAuthentication",
"keyFileContent": {
"type": "SecureString",
"value": "<key file JSON string>"
}
}
}
}
資料集屬性
如需可用來定義資料集的區段和屬性完整清單,請參閱資料集一文。 本節提供 Google BigQuery 資料集所支援的屬性清單。
若要從Google BigQuery 複製數據,請將數據集的類型屬性設定為 GoogleBigQueryV2Object。 以下是支援的屬性:
屬性 | 描述 | 必要 |
---|---|---|
type | 數據集的類型屬性必須設定為: GoogleBigQueryV2Object | Yes |
資料集 | Google BigQuery 資料集的名稱。 | 否 (如果已指定活動來源中的「查詢」) |
table | 資料表的名稱。 | 否 (如果已指定活動來源中的「查詢」) |
範例
{
"name": "GoogleBigQueryDataset",
"properties": {
"type": "GoogleBigQueryV2Object",
"linkedServiceName": {
"referenceName": "<Google BigQuery linked service name>",
"type": "LinkedServiceReference"
},
"schema": [],
"typeProperties": {
"dataset": "<dataset name>",
"table": "<table name>"
}
}
}
複製活動屬性
如需可用來定義活動的區段和屬性完整清單,請參閱管線一文。 本節提供 Google BigQuery 來源類型所支援的屬性清單。
GoogleBigQuerySource 作為來源類型
若要從Google BigQuery 複製數據,請將複製活動中的來源類型設定為 GoogleBigQueryV2Source。 複製活動的 [來源] 區段支援下列屬性。
屬性 | 描述 | 必要 |
---|---|---|
type | 複製活動來源的 type 屬性必須設定為 GoogleBigQueryV2Source。 | Yes |
query | 使用自訂 SQL 查詢來讀取資料。 例如 "SELECT * FROM MyTable" 。 如需詳細資訊,請移至 查詢語法。 |
否(如果已指定資料集中的「資料集」和「資料表」) |
範例:
"activities":[
{
"name": "CopyFromGoogleBigQuery",
"type": "Copy",
"inputs": [
{
"referenceName": "<Google BigQuery input dataset name>",
"type": "DatasetReference"
}
],
"outputs": [
{
"referenceName": "<output dataset name>",
"type": "DatasetReference"
}
],
"typeProperties": {
"source": {
"type": "GoogleBigQueryV2Source",
"query": "SELECT * FROM MyTable"
},
"sink": {
"type": "<sink type>"
}
}
}
]
查閱活動屬性
若要了解屬性的詳細資料,請參閱查閱活動。
升級Google BigQuery 連結服務
若要升級Google BigQuery連結服務,請建立新的Google BigQuery連結服務,並藉由參考 連結服務屬性加以設定。
Google BigQuery 與 Google BigQuery 之間的差異(舊版)
Google BigQuery 連接器提供新功能,並與Google BigQuery (舊版) 連接器的大部分功能相容。 下表顯示Google BigQuery與Google BigQuery(舊版)之間的功能差異。
Google BigQuery | Google BigQuery (舊版) |
---|---|
Azure 整合運行時間和自我裝載整合運行時間支援服務驗證。 只有自我裝載整合運行時間才支援信任的CertPath、useSystemTrustStore、電子郵件和 keyFilePath 屬性。 |
服務驗證僅受自我裝載整合運行時間支援。 支援 trustedCertPath、useSystemTrustStore、電子郵件和 keyFilePath 屬性。 |
下列對應會從Google BigQuery資料類型使用到服務內部使用的過渡數據類型。 數值 -> 十進位 Timestamp -> DateTimeOffset Datetime -> DatetimeOffset |
下列對應會從Google BigQuery資料類型使用到服務內部使用的過渡數據類型。 數值 -> 字串 Timestamp -> DateTime Datetime -> DateTime |
不支援 requestGoogleDriveScope。 您必須藉由參考 選擇Google Drive API 範圍 和 查詢磁碟驅動器數據,來額外套用Google BigQuery服務中的許可權。 | 支援要求GoogleDriveScope。 |
不支援 additionalProjects。 或者, 使用 Google Cloud 控制台查詢公用數據集。 | 支援 additionalProjects。 |
相關內容
如需複製活動支援作為來源和接收器的資料存放區清單,請參閱支援的資料存放區。
意見反映
https://aka.ms/ContentUserFeedback。
即將推出:我們會在 2024 年淘汰 GitHub 問題,並以全新的意見反應系統取代並作為內容意見反應的渠道。 如需更多資訊,請參閱:提交及檢視以下的意見反映: