{"record":{"id":"70654f96b6df19f8","repo":"apache/beam","slug":"bigquery-dependencies-are-not-installed-perf-analysis-utils","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/perf_analysis_utils.py","lineNumber":126,"sourceCode":"def is_change_point_in_valid_window(\n    num_runs_in_change_point_window: int, latest_change_point_run: int) -> bool:\n  return num_runs_in_change_point_window > latest_change_point_run\n\n\ndef get_existing_issues_data(table_name: str) -> Optional[pd.DataFrame]:\n  \"\"\"\n  Finds the most recent GitHub issue created for the test_name.\n  If no table found with name=test_name, return (None, None)\n  else return latest created issue_number along with\n  \"\"\"\n  query = f\"\"\"\n  SELECT * FROM {constants._BQ_PROJECT_NAME}.{constants._BQ_DATASET}.{table_name}\n  ORDER BY {constants._ISSUE_CREATION_TIMESTAMP_LABEL} DESC\n  LIMIT 10\n  \"\"\"\n  try:\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    existing_issue_data = query_job.result().to_dataframe()\n  except exceptions.NotFound:\n    # If no table found, that means this is first performance regression\n    # on the current test+metric.\n    return None\n  return existing_issue_data\n\n\ndef is_sibling_change_point(\n    previous_change_point_timestamps: list[pd.Timestamp],\n    change_point_index: int,\n    timestamps: list[pd.Timestamp],\n    min_runs_between_change_points: int,\n    test_id: str,\n) -> bool:\n  \"\"\"","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/testing/analyzers/perf_analysis_utils.py#L108-L144","documentation":"perf_analysis_utils.get_existing_issues_data queries BigQuery for previously filed GitHub issues about a test+metric regression. The google-cloud-bigquery import may be None when dependencies are missing, in which case it raises ImportError before creating the client.","triggerScenarios":"Calling run_change_point_analysis (which calls get_existing_issues_data) in a Python environment without google-cloud-bigquery installed (Beam installed without the [gcp] extra).","commonSituations":"Local dev runs of the change-point analysis without GCP deps; lightweight CI images; post-processing load-test results on a machine with a bare apache-beam install.","solutions":["pip install 'apache-beam[gcp]' to pull in google-cloud-bigquery","Or pip install google-cloud-bigquery directly","Run the analysis script inside the Beam load-test container image that includes GCP extras"],"exampleFix":"// before\npip install apache-beam==2.xx.0\n// after\npip install 'apache-beam[gcp]'","handlingStrategy":"validation","validationCode":"import importlib.util\nif importlib.util.find_spec('google.cloud.bigquery') is None:\n    raise SystemExit(\"BigQuery missing: pip install 'apache-beam[gcp]'\")","typeGuard":"def has_bigquery() -> bool:\n    import importlib.util\n    return importlib.util.find_spec('google.cloud.bigquery') is not None","tryCatchPattern":"try:\n    issues = get_existing_issues_data(test_name, metric_name)\nexcept ImportError as e:\n    if 'Bigquery dependencies are not installed' in str(e):\n        logging.error(\"Install: pip install 'apache-beam[gcp]'\")\n        issues = None\n    else:\n        raise","preventionTips":["Always install apache-beam[gcp] for anything touching google.cloud.*","Probe for the bigquery module at script start and fail fast with an actionable message","Document GCP extras in the analysis job's README/requirements"],"tags":["python","apache-beam","bigquery","missing-dependency"],"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"}