本記事では CData サポート担当からこんなことを聞かれたらどこを確認すべきか?という観点で、よく頂くお問合せ内容をご紹介します。
記事はこちら →CData ADO.NET Provider for Google Data Catalog は、ADO.NET 標準インターフェースへ統合し、PowerShell のような. NET アプリケーションからGoogle Data Catalog API へのデータ連携を可能にします。このプロバイダーは、Google Data Catalog の認証および相互作用を簡単にします。このチュートリアルでは、PowerShell から直接SQL クエリを実行するための、いくつかの一般的なADO.NET オブジェクトの使い方を説明します。
次の3つのステップに従って SELECT クエリ PowerShell からリアルタイムGoogle Data Catalog に実行:
プロバイダーのアセンブリをロード:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Google Data Catalog\lib\System.Data.CData.GoogleDataCatalog.dll")
Google Data Catalog に接続:
Google Data Catalog uses the OAuth authentication standard. Authorize access to Google APIs on behalf on individual users or on behalf of users in a domain.
Before connecting, specify the following to identify the organization and project you would like to connect to:
Click the project selection drop-down, and select your organization from the list. Then, click More -> Settings. The organization ID is displayed on this page.
Find this by navigating to the cloud console dashboard and selecting your project from the Select from drop-down. The project ID will be present in the Project info card.
When you connect, the OAuth endpoint opens in your default browser. Log in and grant permissions to the application to completes the OAuth process. For more information, refer to the OAuth section in the Help documentation.
$constr = "ProjectId=YourProjectId;"
$conn= New-Object System.Data.CData.GoogleDataCatalog.GoogleDataCatalogConnection($constr)
$conn.Open()
GoogleDataCatalogDataAdapter のインスタンスを生成してSQL クエリを実行し、結果を出力:
$sql="SELECT Type, DatasetName from Schemas"
$da= New-Object System.Data.CData.GoogleDataCatalog.GoogleDataCatalogDataAdapter($sql, $conn)
$dt= New-Object System.Data.DataTable
$da.Fill($dt)
$dt.Rows | foreach { Write-Host $_.type $_.datasetname }