{"library":"google-cloud-bigquery","install":[{"cmd":"pip install google-cloud-bigquery","imports":["from google.cloud import bigquery\n\n# ADC auth — uses GOOGLE_APPLICATION_CREDENTIALS env var\n# or gcloud CLI credentials locally\nclient = bigquery.Client(project='my-project')\n\n# query() returns a QueryJob — NOT results\nquery = \"\"\"\n    SELECT name, COUNT(*) as count\n    FROM `bigquery-public-data.usa_names.usa_1910_2013`\n    WHERE state = 'TX'\n    GROUP BY name\n    ORDER BY count DESC\n    LIMIT 10\n\"\"\"\nquery_job = client.query(query)  # starts job\nrows = query_job.result()       # BLOCKS until complete\n\nfor row in rows:\n    print(row.name, row.count)","from google.cloud import bigquery\n\nclient = bigquery.Client(project='my-project')\nquery = 'SELECT id, name, created_at FROM `myproject.mydataset.mytable` LIMIT 100'\n\n# to_dataframe() requires pandas + pyarrow + db-dtypes\ndf = client.query(query).result().to_dataframe()\nprint(df.dtypes)\n# id: Int64 (nullable) — not int64\n# name: object\n# created_at: dbdate"]},{"cmd":"pip install 'google-cloud-bigquery[pandas]'","imports":[]},{"cmd":"pip install 'google-cloud-bigquery[pandas,pyarrow]'","imports":[]}]}