{"record":{"id":"f2ff3b9e4e9dddfc","repo":"apache/beam","slug":"bigquery-dependencies-are-not-installed","errorCode":null,"errorMessage":"Bigquery dependencies are not installed.","messagePattern":"Bigquery dependencies are not installed\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/testing/analyzers/load_test_perf_analysis.py","lineNumber":55,"sourceCode":"    \"\"\"\n  def fetch_metric_data(\n      self, *, test_config: TestConfigContainer) -> MetricContainer:\n    if test_config.test_name:\n      test_name, pipeline_name = test_config.test_name.split(',')\n    else:\n      raise Exception(\"test_name not provided in config.\")\n\n    query = f\"\"\"\n      SELECT timestamp, metric.value\n      FROM {test_config.project}.{test_config.metrics_dataset}.{test_config.metrics_table}\n      CROSS JOIN UNNEST(metrics) AS metric\n      WHERE test_name = \"{test_name}\" AND pipeline_name = \"{pipeline_name}\" AND metric.name = \"{test_config.metric_name}\"\n      ORDER BY timestamp DESC\n      LIMIT {constants._NUM_DATA_POINTS_TO_RUN_CHANGE_POINT_ANALYSIS}\n    \"\"\"\n    logging.debug(\"Running query: %s\" % query)\n    if bigquery is None:\n      raise ImportError('Bigquery dependencies are not installed.')\n    client = bigquery.Client()\n    query_job = client.query(query=query)\n    metric_data = query_job.result().to_dataframe()\n    if metric_data.empty:\n      logging.error(\n          \"No results returned from BigQuery. Please check the query.\")\n    return MetricContainer(\n        values=metric_data['value'].tolist(),\n        timestamps=metric_data['timestamp'].tolist(),\n    )\n\n\nif __name__ == '__main__':\n  logging.basicConfig(level=logging.INFO)\n  load_test_metrics_fetcher = LoadTestMetricsFetcher()\n\n  parser = argparse.ArgumentParser()\n  parser.add_argument(","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/testing/analyzers/load_test_perf_analysis.py#L37-L73","documentation":"fetch_metric_data in load_test_perf_analysis.py imports google-cloud-bigquery lazily; if the import failed (bigquery is None), it raises ImportError when it needs a BigQuery client. This guards against executing the perf-analysis query without the required dependency installed.","triggerScenarios":"Running the analyzer in an environment where apache-beam was installed without gcp extras (pip install apache-beam without [gcp]), so google.cloud.bigquery is unavailable and the `bigquery` import resolved to None.","commonSituations":"CI or local environments lacking the gcp extra; slim Docker images for Beam workers used to run the analyzer; dependencies pruned to reduce image size.","solutions":["Install with GCP extras: pip install 'apache-beam[gcp]'","Install the missing package directly: pip install google-cloud-bigquery","Run the analysis in an environment (container/VM) that includes Beam's gcp extra requirements"],"exampleFix":"// before\npip install apache-beam\n// after\npip install 'apache-beam[gcp]'","handlingStrategy":"validation","validationCode":"try:\n    import google.cloud.bigquery  # noqa\nexcept ImportError:\n    raise SystemExit(\"Install GCP deps: pip install 'apache-beam[gcp]'\")","typeGuard":"def bigquery_available() -> bool:\n    import importlib.util\n    return importlib.util.find_spec('google.cloud.bigquery') is not None","tryCatchPattern":"try:\n    metric_data = analyzer.fetch_metric_data(test_config=config)\nexcept ImportError as e:\n    if 'Bigquery dependencies are not installed' in str(e):\n        logging.error(\"Run: pip install 'apache-beam[gcp]'\")\n    else:\n        raise","preventionTips":["Install Beam with the [gcp] extra in analysis environments","Check for the google.cloud.bigquery module early in scripts","Use the official Beam load-test container image for analysis jobs"],"tags":["python","apache-beam","bigquery","missing-dependency","load-testing"],"backgroundTag":"missing-dependency","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}