{"id":1065,"library":"gcloud-aio-bigquery","title":"Google Cloud BigQuery Client (async)","description":"gcloud-aio-bigquery is an asynchronous Python client for Google Cloud BigQuery, built on `asyncio` and `aiohttp`. It's part of the `gcloud-aio-*` family, providing an asynchronous HTTP implementation of Google Cloud client libraries. The current version is 7.1.0 and it maintains an active release cadence.","status":"active","version":"7.1.0","language":"python","source_language":"en","source_url":"https://github.com/talkiq/gcloud-aio","tags":["google cloud","bigquery","async","aiohttp","gcp"],"install":[{"cmd":"pip install gcloud-aio-bigquery","lang":"bash","label":"Install `gcloud-aio-bigquery`"}],"dependencies":[{"reason":"Core HTTP client library for asynchronous operations.","package":"aiohttp"},{"reason":"Provides asynchronous authentication mechanisms for Google Cloud services.","package":"gcloud-aio-auth"}],"imports":[{"wrong":"from gcloud.aio.bigquery import BigQuery","symbol":"BigQuery","correct":"from gcloud.aio.bigquery import BigQuery"}],"quickstart":{"code":"import asyncio\nimport os\nimport aiohttp\nfrom gcloud.aio.auth import Token\nfrom gcloud.aio.bigquery import BigQuery\n\nasync def main():\n    # Ensure GOOGLE_CLOUD_PROJECT and GOOGLE_APPLICATION_CREDENTIALS\n    # are set in your environment for authentication.\n    project = os.environ.get('GOOGLE_CLOUD_PROJECT', 'your-gcp-project-id') # Replace with your project ID\n    \n    async with aiohttp.ClientSession() as session:\n        # Obtain Google Cloud credentials token\n        token = await Token(session=session).get()\n        \n        # Initialize BigQuery client\n        client = BigQuery(project=project, session=session, token=token)\n\n        query = \"\"\"\n            SELECT name, SUM(number) as total_babies\n            FROM `bigquery-public-data.usa_names.usa_1910_2013`\n            WHERE state = 'TX'\n            GROUP BY name\n            ORDER BY total_babies DESC\n            LIMIT 5\n        \"\"\"\n        \n        print(f\"Executing query for project: {project}\")\n        job_id, result = await client.query_and_wait(query)\n        \n        print(f\"Query Job ID: {job_id}\")\n        print(\"Top 5 baby names in Texas (1910-2013):\")\n        \n        for row in result['rows']:\n            print(f\"- {row['name']}: {row['total_babies']}\")\n\nif __name__ == \"__main__\":\n    asyncio.run(main())","lang":"python","description":"This quickstart demonstrates how to initialize the `BigQuery` client, authenticate using `gcloud-aio-auth`, and execute a simple SQL query against a public BigQuery dataset. Ensure your `GOOGLE_CLOUD_PROJECT` environment variable is set to your Google Cloud project ID, and `GOOGLE_APPLICATION_CREDENTIALS` points to your service account key file for local execution."},"warnings":[{"fix":"Use BigQuery DML statements (e.g., `DELETE FROM ... WHERE ...`) via the client's query method, or consider using the synchronous `google-cloud-bigquery` client for direct `delete` API calls if available there.","message":"The `gcloud-aio-bigquery` library currently does not support deleting rows from a table via its API. Users requiring this functionality may need to use alternative methods like the standard `google-cloud-bigquery` library or BigQuery's DML statements directly.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always explicitly import from the correct full path for the client class. For `gcloud-aio-*` clients, this often means `from gcloud.aio.<service_name>.<service_name> import <ClientClassName>` (e.g., `from gcloud.aio.bigquery.bigquery import BigqueryClient`), and for `gcloud-rest-*` clients, `from gcloud.rest.<service_name> import <ClientClassName>`. Consult the specific library's documentation or source code for exact import paths.","message":"There can be confusion between `gcloud-aio-*` (asynchronous) and `gcloud-rest-*` (synchronous) client libraries, as they share a codebase and similar naming conventions. Additionally, the main client classes within `gcloud.aio.<service_name>` modules may not be directly exposed at the top level of the service module (e.g., `gcloud.aio.bigquery`), requiring deeper imports.","severity":"gotcha","affected_versions":"All versions"},{"fix":"When dealing with nullable fields, especially integers, implement robust error handling or explicitly cast/check for `None` values before processing. Consider inspecting the raw `result` structure before using helper functions if this issue occurs.","message":"The `query_response_to_dict` utility may raise exceptions when processing nullable integer fields that contain `None` values. This can lead to data parsing errors for queries returning sparse data.","severity":"gotcha","affected_versions":"Prior to 7.1.0, potentially still present"},{"fix":"Always specify only the columns you need in your `SELECT` statements. Use `LIMIT` and `WHERE` clauses effectively to reduce data scanned.","message":"Overusing `SELECT *` in BigQuery queries can significantly increase query costs and execution time, as BigQuery charges based on the amount of data scanned. This is a fundamental BigQuery best practice that applies to `gcloud-aio-bigquery` as well.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Verify the exact class name and import path for the BigQuery client. Common patterns for `gcloud-aio` libraries include importing `Client` (e.g., `from gcloud.aio.bigquery import Client`) or `BigqueryClient` from a submodule (e.g., `from gcloud.aio.bigquery.client import BigqueryClient`). Refer to the library's documentation for the correct import statement.","message":"The `BigQuery` client class cannot be imported directly using `from gcloud.aio.bigquery import BigQuery`. The primary client class might be named differently (e.g., `Client` or `BigqueryClient`) or reside in a deeper submodule within `gcloud.aio.bigquery`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'7.1.0':47 'activ':52 'aio':8,31 'aiohttp':23,59 'async':5,58 'asynchron':12,35 'asyncio':21 'bigqueri':3,9,18,57 'built':19 'cadenc':54 'client':4,14,41 'cloud':2,17,40,56 'current':44 'famili':32 'gcloud':7,30 'gcloud-aio':29 'gcloud-aio-bigqueri':6 'gcp':60 'googl':1,16,39,55 'http':36 'implement':37 'librari':42 'maintain':50 'part':26 'provid':33 'python':13 'releas':53 'version':45","created_at":"2026-04-01T15:38:16.602911+00:00","updated_at":"2026-04-15T18:11:33.002948+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nImportError: cannot import name 'BigQuery' from 'gcloud.aio.bigquery' (/tmp/tmpf6vitz9b/venv/lib/python3.12/site-packages/gcloud/aio/bigquery/__init__.py). Did you mean: 'bigquery'?"},"ecosystem":"pypi","meta_description":null,"install_score":0,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"7.1.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/talkiq/gcloud-aio","docs":null,"changelog":null,"pypi":"https://pypi.org/project/gcloud-aio-bigquery/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["gcp","http-networking","database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":"stale"}}