gcs bigquerty python - ghdrako/doc_snipets GitHub Wiki

pip install google-cloud-bigquery
from google.cloud import bigquery
from google.oauth2 import service_account

credentials = service_account.Credentials.from_service_account_file('sa.json')
client = bigquery.Client(credentials=credentials)
query = 'SELECT * FROM `sales.mobile_sales` \
           WHERE ... '
query_job = client.query(query)
rows = query_job.result()
for row in rows:
  print(row.City,row.Total ....)