Skip to content

[BEAM-10917] Add support for BigQuery Read API in Python BEAM - #15602

Merged
pabloem merged 12 commits into
apache:masterfrom
vachan-shetty:support-direct-read
Oct 6, 2021
Merged

pabloem merged 12 commits into
apache:masterfrom
vachan-shetty:support-direct-read

Conversation

@vachan-shetty

@vachan-shetty vachan-shetty commented Sep 27, 2021 •

Copy link
Copy Markdown
Contributor

The proposal detailing these changes can be found here.


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

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • 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.

ValidatesRunner compliance status (on master branch)

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- Build Status Build Status Build Status Build Status ---
Java Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Python --- Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status ---
XLang Build Status Build Status Build Status Build Status Build Status ---

Examples testing status on various runners

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- --- --- --- --- --- ---
Java --- Build Status
Build Status
Build Status
--- --- --- --- ---
Python --- --- --- --- --- --- ---
XLang --- --- --- --- --- --- ---

Post-Commit SDK/Transform Integration Tests Status (on master branch)

Go Java Python
Build Status Build Status Build Status
Build Status
Build Status

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website Whitespace Typescript
Non-portable Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status Build Status Build Status
Portable --- Build Status Build Status --- --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@codecov

codecov Bot commented Sep 27, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #15602 (5c81b1b) into master (2a3d887) will decrease coverage by 0.35%.
The diff coverage is 27.51%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15602      +/-   ##
==========================================
- Coverage   83.81%   83.46%   -0.36%     
==========================================
  Files         444      445       +1     
  Lines       60464    61074     +610     
==========================================
+ Hits        50676    50973     +297     
- Misses       9788    10101     +313     
Impacted Files Coverage Δ
...ython/apache_beam/io/gcp/bigquery_read_internal.py 53.92% <15.00%> (-4.24%) ⬇️
sdks/python/apache_beam/io/gcp/bigquery.py 62.72% <24.07%> (-12.84%) ⬇️
sdks/python/apache_beam/io/gcp/bigquery_tools.py 82.91% <30.00%> (-3.82%) ⬇️
sdks/python/apache_beam/coders/row_coder.py 95.07% <100.00%> (+0.03%) ⬆️
sdks/python/apache_beam/typehints/schemas.py 94.44% <100.00%> (+0.24%) ⬆️
...ython/apache_beam/runners/interactive/sql/utils.py 76.09% <0.00%> (-7.91%) ⬇️
...he_beam/runners/interactive/sql/beam_sql_magics.py 49.75% <0.00%> (-4.79%) ⬇️
...hon/apache_beam/runners/direct/test_stream_impl.py 94.02% <0.00%> (-2.24%) ⬇️
sdks/python/apache_beam/internal/metrics/metric.py 90.00% <0.00%> (-1.00%) ⬇️
...pache_beam/runners/interactive/interactive_beam.py 75.60% <0.00%> (-0.98%) ⬇️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 686efb3...5c81b1b. Read the comment docs.

@vachan-shetty

Copy link
Copy Markdown
Contributor Author

R: @kmjung @emkornfield

@vachan-shetty

Copy link
Copy Markdown
Contributor Author

R: @pabloem

Comment thread sdks/python/apache_beam/io/gcp/bigquery.py Outdated
"""
class Method(object):
EXPORT = 'EXPORT' # This is currently the default.
DIRECT_READ = 'DIRECT_READ'

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.

nit: I believe this api are known as "BigQuery Storage Read API". Would it be better to specify method as STORAGE_API_READ or something similar not to confuse the user?

@vachan-shetty vachan-shetty Sep 30, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I used DIRECT_READ to keep it the same as the Java SDK.

@kmjung: What do you think?

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.

I'm not sure that I have a sense of what Beam values here (consistency across languages vs. consistency with external naming). I guess my slight preference would be for the former, which would mean carrying over the DIRECT_READ name. @satybald @pabloem @chamikaramj what do you think?

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.

I also like keeping consistency with Java

Comment thread sdks/python/apache_beam/io/gcp/bigquery.py
Comment thread sdks/python/apache_beam/io/gcp/bigquery.py
Comment thread sdks/python/apache_beam/io/gcp/bigquery.py Outdated
Comment thread sdks/python/apache_beam/io/gcp/bigquery.py

@satybald satybald left a comment

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.

Left couple comments but overall approach LGTM. Thank you for support of BQ Stroage API 💯

@pabloem

pabloem commented Oct 4, 2021

Copy link
Copy Markdown
Member

Run Python 3.8 PostCommit

@vachan-shetty

Copy link
Copy Markdown
Contributor Author

Run PythonDocs PreCommit

@vachan-shetty

Copy link
Copy Markdown
Contributor Author

Run Python 3.8 PostCommit

1 similar comment
@vachan-shetty

Copy link
Copy Markdown
Contributor Author

Run Python 3.8 PostCommit

@vachan-shetty

Copy link
Copy Markdown
Contributor Author

Run Python 3.8 PostCommit

@vachan-shetty

Copy link
Copy Markdown
Contributor Author

Run Python 3.8 PostCommit

@pabloem

pabloem commented Oct 5, 2021

Copy link
Copy Markdown
Member

storage api tests are passing: https://ci-beam.apache.org/job/beam_PostCommit_Python38_PR/331/testReport/apache_beam.io.gcp.bigquery_read_it_test/

we can rernu to get a passing run

@pabloem

pabloem commented Oct 5, 2021

Copy link
Copy Markdown
Member

Run Python 3.8 PostCommit

@vachan-shetty

Copy link
Copy Markdown
Contributor Author

Run Python 3.8 PostCommit

@pabloem

pabloem commented Oct 6, 2021

Copy link
Copy Markdown
Member

ok thisLGTM. We only have one failure related to the DebeziumIO test which is failing elsewhere.

I'll merge this

@pabloem
pabloem merged commit 4012a46 into apache:master Oct 6, 2021
dmitriikuzinepam pushed a commit to dmitriikuzinepam/beam that referenced this pull request Nov 2, 2021
…Query Read API in Python BEAM

* Enable reading from BigQuery using BQ Storage Read API.

* Add error handling for temp dataset deletion and some lint fixes.

* Adding some EXPORT source code that was mistakenly removed.

* Remove table labelling and other minor fixes.

* Adding the "method" of reading to display data.

* Fix for failing pre-commit tests.

* Adding query priority to ReadAPI source.

* Doc fix.

* Adding retries to Read API source query execution.

* Use unique labels for temp datasets and remove retries for query execution in source.

* Updating CHANGES.md.
jrmccluskey pushed a commit that referenced this pull request Oct 6, 2026
#40430)

_CustomBigQueryStorageSource._setup_temporary_dataset logged the dataset
labels at warning level, right before passing them to
create_temporary_dataset. The "###" prefix appears in no other logging
call under sdks/python/apache_beam, and str() is redundant with %s, both
of which point at a debug print rather than an intended log line.

The labels come from the user, so the value carries no information the
caller does not already have.

The line dates back to #15602 and no test refers to it. _LOGGER is still
used at nine call sites in the module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants