Slide 23
Slide 23 text
23
しょうがないので力技を使います
解決策:Google ColaboratoryからBigQuery Connection APIで作成
# BigQuery Connection API のサービスクライアントを作成
service = build('bigqueryconnection', 'v1', credentials=credentials)
# 接続の親パスと接続名(※マスク済み)
project_id = "your-project-id"
location = "asia-northeast1"
connection_id = "your-connection-id"
parent = f"projects/{project_id}/locations/{location}"
# 接続の本体(今回は cloudResource タイプ)
body = {
"friendlyName": "BQ Remote Function Connection",
"cloudResource": {}
}
# 外部接続の作成
response = service.projects().locations().connections().create(
parent=parent,
connectionId=connection_id,
body=body
).execute()