Skip to content

Make the BQ hook importable when google libs are mocked - #73615

Merged
ashb merged 3 commits into
apache:mainfrom
astronomer:worktree-bigquery-mock-import
Sep 23, 2026
Merged

ashb merged 3 commits into
apache:mainfrom
astronomer:worktree-bigquery-mock-import

Conversation

@amoghrajesh

@amoghrajesh amoghrajesh commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

related to: #73604

Sphinx replaces the Google client libraries with placeholder objects when building the provider docs. BigQueryJob is built at module scope with the | operator, which only works on real classes, so importing the hook under those placeholders raises TypeError and fails the docs build.

Nothing uses BigQueryJob at runtime; it appears only in annotations.

Works fine after the changes:

amoghrajesh.desai  …/exampleinclude-no-import   main $⇣    orbstack  ♥ 17:46  breeze build-docs google --docs-only --one-pass-only

Docker container engine detected.
Good version of Docker: 29.4.0.
Good version of docker-compose: 5.1.2
Good version of uv: 0.12.13.
Host python version is 3.14.6 (main, Jun 23 2026, 15:46:31) [Clang 22.1.3 ]
Docker image ghcr.io/apache/airflow/main/ci/python3.10 was built from the same important sources - no rebuild is needed.
Removing all generated dirs.
Docker container engine detected.
Detected git worktree. Mounting main git directory: /Users/amoghrajesh.desai/Documents/OSS/repos/airflow/.git

Using 'uv' to install Airflow


Using airflow version from current sources


Using 'uv' to install Airflow

#################### Fetching inventories ####################
Nothing to do
Building one package. Forcing --one-pass-only and --jobs to 1 as only one pass is needed.
#################### Documentation will be built for 1 package(s) ####################
1. apache-airflow-providers-google
#################### Cleaning documentation files ####################
apache-airflow-providers-google                             : Cleaning files
apache-airflow-providers-google                             : Building documentation


2026-09-23T12:29:23.599272Z [info     ] Adding content weights to HTML files... [sphinx_exts.pagefind_search.builder] loc=builder.py:95
2026-09-23T12:29:24.508217Z [info     ] Added content weights to 1255 files [sphinx_exts.pagefind_search.builder] loc=builder.py:100
2026-09-23T12:29:24.508364Z [info     ] Building Pagefind search index... [sphinx_exts.pagefind_search.builder] loc=builder.py:112
2026-09-23T12:29:25.285499Z [info     ] Pagefind indexed 1258 pages    [sphinx_exts.pagefind_search.builder] loc=builder.py:166
2026-09-23T12:29:26.409373Z [info     ] ✓ Pagefind index created with 1258 pages [sphinx_exts.pagefind_search.builder] loc=builder.py:198
apache-airflow-providers-google                             : Finished docs building successfully
Documentation build is successful

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@boring-cyborg boring-cyborg Bot added area:providers provider:google Google (including GCP) related issues labels Sep 23, 2026
@amoghrajesh
amoghrajesh requested a review from ashb September 23, 2026 12:35
@amoghrajesh amoghrajesh self-assigned this Sep 23, 2026

@ashb ashb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a mistake, so will need comment on the else arm saying why it's required.

@amoghrajesh

Copy link
Copy Markdown
Contributor Author

@ashb better: 6aba7e3?

@ashb
ashb merged commit f77f7e4 into apache:main Sep 23, 2026
85 checks passed
@ashb
ashb deleted the worktree-bigquery-mock-import branch September 23, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:google Google (including GCP) related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants