# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import google.auth
from google.cloud import bigquery
from google.cloud import bigquery_storage_v1beta1
# Explicitly create a credentials object. This allows you to use the same
# credentials for both the BigQuery and BigQuery Storage clients, avoiding
# unnecessary API calls to fetch duplicate authentication tokens.
credentials, your_project_id = google.auth.default(
scopes=["https://www.googleapis.com/auth/cloud-platform"]
)
# Make clients.
bqclient = bigquery.Client(
credentials=credentials,
project=your_project_id
)
bqstorageclient = bigquery_storage_v1beta1.BigQueryStorageClient(
credentials=credentials
)
pandas读取 bigquery
最新推荐文章于 2025-08-30 14:41:48 发布
本文介绍如何利用Google Cloud的BigQuery和BigQuery Storage API进行数据查询和处理,通过创建凭证对象实现两个客户端间的资源共享,避免了重复获取认证令牌的不必要API调用。
4779

被折叠的 条评论
为什么被折叠?



