import sys, json from google.cloud import bigquery import google.auth creds=google.auth.default(scopes=['https://www.googleapis.com/auth/bigquery'])[0].with_quota_project(None) c=bigquery.Client(project='autingo-159109', location='europe-west1', credentials=creds) sql=sys.stdin.read() for r in c.query(sql).result(): print(json.dumps(dict(r), default=str))