{"record":{"id":"8025d3f3b278b50d","repo":"cocoindex-io/cocoindex","slug":"google-cloud-bigquery-is-required-to-use-the-bigqu","errorCode":null,"errorMessage":"google-cloud-bigquery is required to use the BigQuery connector. Please install cocoindex[bigquery].","messagePattern":"google-cloud-bigquery is required to use the BigQuery connector\\. Please install cocoindex\\[bigquery\\]\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"python/cocoindex/connectors/bigquery/_target.py","lineNumber":406,"sourceCode":") -> tuple[QueryParam, ...]:\n    pk_columns = [table_schema.columns[pk] for pk in table_schema.primary_key]\n    params: list[QueryParam] = []\n    idx = 0\n    for key in keys:\n        for key_idx, value in enumerate(key):\n            col = pk_columns[key_idx]\n            params.append(QueryParam(f\"p{idx}\", _query_param_type(col), value))\n            idx += 1\n    return tuple(params)\n\n\n@contextmanager\ndef _connect(config: ConnectionConfig) -> Iterator[Any]:\n    try:\n        from google.cloud import bigquery  # type: ignore[import-not-found]\n        from google.oauth2 import service_account  # type: ignore[import-not-found]\n    except ImportError as e:\n        raise ImportError(\n            \"google-cloud-bigquery is required to use the BigQuery connector. \"\n            \"Please install cocoindex[bigquery].\"\n        ) from e\n\n    credentials = None\n    if config.credentials_path:\n        credentials = service_account.Credentials.from_service_account_file(  # type: ignore[no-untyped-call]\n            config.credentials_path\n        )\n\n    client = bigquery.Client(\n        project=config.project,\n        credentials=credentials,\n        location=config.location,\n    )\n    try:\n        yield client\n    finally:","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/cocoindex-io/cocoindex/blob/e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b/python/cocoindex/connectors/bigquery/_target.py#L388-L424","documentation":"Raised by _connect in the BigQuery connector when the google-cloud-bigquery package (or its google.oauth2 dependency) is not installed. The connector lazily imports it at connection time and converts the ImportError into an actionable message pointing at the cocoindex[bigquery] extra.","triggerScenarios":"Declaring/using a BigQuery target (which triggers _apply_actions -> _connect) in an environment where `pip install cocoindex[bigquery]` was not run.","commonSituations":"Installing base cocoindex in CI or a fresh venv without extras; switching to the BigQuery connector in an existing project; using a slim Docker image that omits optional dependencies.","solutions":["Install the extra: `pip install \"cocoindex[bigquery]\"` (or `uv add \"cocoindex[bigquery]\"`).","Verify the import works: `python -c \"from google.cloud import bigquery\"`.","If using service-account auth, also confirm google-auth/google-oauth2 are present (they come with the extra)."],"exampleFix":"// before\npip install cocoindex\n// after\npip install \"cocoindex[bigquery]\"","handlingStrategy":"fallback","validationCode":"try:\n    import google.cloud.bigquery  # noqa\nexcept ImportError:\n    raise SystemExit('Run: pip install \"cocoindex[bigquery]\"')","typeGuard":null,"tryCatchPattern":"try:\n    app.update()\nexcept ImportError as e:\n    if \"cocoindex[bigquery]\" in str(e):\n        # surface install hint to user\n        ...","preventionTips":["Always install extras for connectors you use: cocoindex[bigquery]","Pin the extra in pyproject/requirements so CI matches dev","Smoke-test imports in CI before running pipelines"],"tags":["bigquery","import-error","dependencies"],"backgroundTag":"missing-optional-dependency","analyzedSha":"e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b","analyzedAt":"2026-09-08T15:59:19.997Z","contentChangedAt":"2026-09-08T15:59:19.997Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}