Skip to content

[Python] Support Lakehouse runtime catalog tables in ReadFromBigQuery… - #40225

Merged
tvalentyn merged 3 commits into
apache:masterfrom
claudevdm:bigquery-pcnt-python
Oct 5, 2026
Merged

tvalentyn merged 3 commits into
apache:masterfrom
claudevdm:bigquery-pcnt-python

Conversation

@claudevdm

Copy link
Copy Markdown
Collaborator

… DIRECT_READ

Port of the Java change in #39597 to the Python SDK.

  • parse_table_reference now assigns segments by explicit splitting (mirroring BigQueryHelpers.parseTableSpec) so 4-part project.catalog.namespace.table and project:catalog.namespace.table specs map to a composite catalog.namespace dataset id. Previously the dotted form raised and the colon form silently bound the project to project:catalog.
  • Storage Read split tolerates tables that report no numBytes by requesting zero streams so the Read API picks the stream count; the export source's size estimate returns 0 instead of raising.
  • Unit tests for the new spec forms, domain-scoped projects, invalid specs, and the numBytes-missing paths.

Please add a meaningful description for your change here


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

… DIRECT_READ

Port of the Java change in apache#39597 to the Python SDK.

- parse_table_reference now assigns segments by explicit splitting (mirroring
  BigQueryHelpers.parseTableSpec) so 4-part `project.catalog.namespace.table`
  and `project:catalog.namespace.table` specs map to a composite
  `catalog.namespace` dataset id. Previously the dotted form raised and the
  colon form silently bound the project to `project:catalog`.
- Storage Read split tolerates tables that report no numBytes by requesting
  zero streams so the Read API picks the stream count; the export source's
  size estimate returns 0 instead of raising.
- Unit tests for the new spec forms, domain-scoped projects, invalid specs,
  and the numBytes-missing paths.
@claudevdm
claudevdm force-pushed the bigquery-pcnt-python branch from f5dbd12 to 576282a Compare October 2, 2026 16:10
@claudevdm
claudevdm marked this pull request as ready for review October 2, 2026 16:12
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @tvalentyn for label python.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@@ -29,7 +29,10 @@
Also, for programming convenience, instances of TableReference and TableSchema
have a string representation that can be used for the corresponding arguments:

- TableReference can be a PROJECT:DATASET.TABLE or DATASET.TABLE string.
- TableReference can be a PROJECT:DATASET.TABLE, PROJECT.DATASET.TABLE or
DATASET.TABLE string. Lakehouse runtime catalog (BigLake metastore) tables

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since this is new functionality, can we force a standard format without dot/colon ambiguity and without potentially ambiguous parsing (project.dataset.table vs [no_project].catalog.namespace.table)? For example we could change the docstring to:

TableReference can be a PROJECT:DATASET.TABLE, PROJECT.DATASET.TABLE, DATASET.TABLE, or PROJECT.CATALOG.NAMESPACE.TABLE (for Lakehouse catalog tables).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I dont see a way we can force a standard format.

table is just a string, so we only find out whether it's a 3-part or 4-part
reference by parsing it.

We also can't drop the colon form. get_hashable_destination converts a
TableReference into PROJECT:DATASET.TABLE as the canonical string representation.

So we need colon because of get_hashable_destination, and dot because it's the
modern SQL form we want to encourage. Deprecating colon would be nice, but it's the
destination key throughout the write path, so that's a bigger breaking change.

Updated the docs to mention that project is required for pcnt format

Comment thread sdks/python/apache_beam/io/gcp/bigquery.py Outdated
Comment thread sdks/python/apache_beam/io/gcp/bigquery.py Outdated
@claudevdm
claudevdm requested a review from tvalentyn October 2, 2026 21:56
Comment thread sdks/python/apache_beam/io/gcp/bigquery.py Outdated
Comment thread sdks/python/apache_beam/io/gcp/bigquery.py Outdated
Comment thread sdks/python/apache_beam/io/gcp/bigquery.py Outdated
Comment thread sdks/python/apache_beam/io/gcp/bigquery_tools.py Outdated
@claudevdm
claudevdm requested a review from tvalentyn October 4, 2026 18:10
@codecov

codecov Bot commented Oct 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.95918% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 58.67%. Comparing base (9685063) to head (91aac7e).
⚠️ Report is 30 commits behind head on master.

Files with missing lines Patch % Lines
sdks/python/apache_beam/io/gcp/bigquery_tools.py 97.36% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #40225      +/-   ##
============================================
+ Coverage     58.65%   58.67%   +0.02%     
  Complexity    13843    13843              
============================================
  Files          2579     2581       +2     
  Lines        270366   271356     +990     
  Branches      11212    11212              
============================================
+ Hits         158587   159224     +637     
- Misses       105747   106100     +353     
  Partials       6032     6032              
Flag Coverage Δ
python 79.66% <97.95%> (-0.20%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tvalentyn
tvalentyn merged commit c74609d into apache:master Oct 5, 2026
98 checks passed
@tvalentyn

Copy link
Copy Markdown
Contributor

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants