Skip to content

docs(bigquery): add core job lifecycle samples - #6340

Open
haphungw wants to merge 1 commit into
googleapis:mainfrom
haphungw:sample-core-job-lifecycle
Open

docs(bigquery): add core job lifecycle samples#6340
haphungw wants to merge 1 commit into
googleapis:mainfrom
haphungw:sample-core-job-lifecycle

Conversation

@haphungw

Copy link
Copy Markdown
Contributor

Demonstrate how to manage the lifecycle of BigQuery Jobs. These samples poll JobService to track status and metadata.

Added:

  • bigquery_create_job: Creates and executes a job.
  • bigquery_get_job: Retrieves the execution status and metadata of a job by its ID.
  • bigquery_list_jobs: Lists recently executed jobs in the project.
  • bigquery_cancel_job: Cancels an active analytical query job.

@product-auto-label product-auto-label Bot added api: bigquery Issues related to the BigQuery API. samples Issues that are directly related to samples. labels Aug 11, 2026

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces BigQuery job examples, including creating, getting, listing, and cancelling jobs, along with corresponding integration tests. The feedback suggests a minor refactoring in list_jobs.rs to make the pagination logic more idiomatic by replacing an unnecessary match Some(...) with a simpler if condition.

Comment thread src/bigquery/examples/src/job/list_jobs.rs Outdated
@haphungw
haphungw force-pushed the sample-core-job-lifecycle branch from fb7cfc9 to 245d2a3 Compare August 11, 2026 23:11
@haphungw
haphungw marked this pull request as ready for review August 11, 2026 23:12
@haphungw
haphungw requested a review from a team as a code owner August 11, 2026 23:12
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.10%. Comparing base (95cb898) to head (245d2a3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6340   +/-   ##
=======================================
  Coverage   96.10%   96.10%           
=======================================
  Files         282      282           
  Lines       73304    73304           
=======================================
  Hits        70449    70449           
  Misses       2855     2855           

☔ 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.

Comment on lines +51 to +52
if e.to_string().contains("Root element must be a message") {
// NOTE: A known issue in protobuf/gax serialization for empty POSTs.

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.

Hmmm I thought we fixed this bug.

#2823

Comment on lines +33 to +34
.send()
.await?;

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.

.into_job_poller().until_done().await ?

Comment on lines +39 to +40
// Wait for the job to complete
loop {

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 thought you made this easier.

Comment on lines +29 to +32
if !page_token.is_empty() {
req = req.set_page_token(page_token);
}
let res = req.send().await?;

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.

We have a .by_item() helper so customers dont have to write this loop.

https://googleapis.github.io/google-cloud-rust/pagination.html

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

Labels

api: bigquery Issues related to the BigQuery API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants