GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: add `Client.query_and_wait` which directly returns a `RowIterator` of results by tswast · Pull Request #1722 · googleapis/python-bigquery

This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Conversation

@tswast

@tswast tswast commented Nov 15, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Set the QUERY_PREVIEW_ENABLED=TRUE environment variable to use this with the new JOB_CREATION_OPTIONAL mode (currently in preview).

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Note: Currently in DRAFT mode as I realized that some of the necessary work to speed things up overlaps with the query(api_method="QUERY") work (#1723), so I'll work on modifying that first before moving on to the next step of a "jobless" API.

Towards #589 🦕

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@product-auto-label product-auto-label Bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery API. labels Nov 15, 2023
tswast added 4 commits November 15, 2023 14:19
@tswast
perf: use the first page a results when query(api_method="QUERY")
b8c583a
@tswast
add tests
6a8059d
@tswast
respect max_results with cached page
1f0e38e
@tswast
respect page_size, also avoid bqstorage if almost fully downloaded
4401725
@tswast tswast mentioned this pull request Nov 16, 2023
Provide support for synchronous queries through the v2/projects/{projectId}/queries endpoint #589
Closed
@tswast
skip true test if bqstorage not installed
d078941
chalmerlowe
chalmerlowe reviewed Nov 16, 2023
View reviewed changes
Comment thread google/cloud/bigquery/_job_helpers.py Outdated
timeout: Optional[float],
job_retry: retries.Retry,
) -> table.RowIterator:
"""Initiate a query using jobs.query with jobCreationMode=JOB_CREATION_REQUIRED.

@chalmerlowe chalmerlowe Nov 16, 2023

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Should this be JOB_CREATION_OPTIONAL?
It seems that way based on the descriptions above.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@tswast tswast Nov 20, 2023

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

You're correct. I'll update.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
tswast added 2 commits November 16, 2023 15:02
@tswast
Merge remote-tracking branch 'origin/main' into issue589-RowIterator.…
660aa76
…_is_completely_cached
@tswast
coverage
476bcd7
@tswast tswast mentioned this pull request Nov 17, 2023
feat: add job_id, location, project, and query_id properties on RowIterator #1733
Merged
4 tasks done
tswast added 2 commits November 20, 2023 09:02
@tswast
Merge remote-tracking branch 'origin/main' into issue589-RowIterator.…
05d6a3e
…_is_completely_cached
@tswast
feat: add Client.query_and_wait which directly returns a `RowIterat…
c16e4be
…or` of results

Set the `QUERY_PREVIEW_ENABLED=TRUE` environment variable to use this with the
new JOB_CREATION_OPTIONAL mode (currently in preview).
@tswast
tswast force-pushed the issue589-query_and_wait branch from 93d47e7 to c16e4be Compare November 20, 2023 19:33
@product-auto-label product-auto-label Bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Nov 20, 2023
@tswast
implement basic query_and_wait and add code sample to test
222f91b
@tswast
tswast changed the base branch from main to issue589-RowIterator._is_completely_cached November 20, 2023 22:13
@tswast
avoid duplicated QueryJob construction
73e5817
Base automatically changed from issue589-RowIterator._is_completely_cached to main November 21, 2023 15:13
tswast added 7 commits November 21, 2023 09:15
@tswast
update unit tests
9508121
@tswast
Merge remote-tracking branch 'origin/main' into issue589-query_and_wait
543481d
@tswast
fix merge conflict in rowiterator
85f1cab
@tswast
support max_results, add tests
c0e6c86
@tswast
retry tests
d4a322d
@tswast
Merge remote-tracking branch 'origin/main' into issue589-query_and_wait
e0b2d2e
@tswast
unit test coverage
9daccbd
@product-auto-label product-auto-label Bot added size: xl Pull request size is extra large. and removed size: l Pull request size is large. labels Nov 22, 2023
tswast added 7 commits November 29, 2023 13:58
@tswast
Merge remote-tracking branch 'origin/main' into issue589-query_and_wait
5afbc41
@tswast
add coverage for job_config
08167d8
@tswast
cancel job if hasn't finished
3e10ea4
@tswast
mypy
dc5e5be
@tswast
allow unrealeased features in samples
f1556bc
@tswast
Merge branch 'main' into issue589-query_and_wait
db71a1b
@tswast
fix for 3.12
bd7e767
mmladenovski
mmladenovski approved these changes Dec 5, 2023
View reviewed changes
Comment thread google/cloud/bigquery/_job_helpers.py
elif page_size is not None or max_results is not None:
request_body["maxResults"] = page_size or max_results

if os.getenv("QUERY_PREVIEW_ENABLED", "").casefold() == "true":

@mmladenovski mmladenovski Dec 5, 2023

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@tswast , in our previous discussion, I only suggested for this environment variable to use a list of project IDs for a more fine-grained control. We have discussed it with @shollyman , and for the Java client we decided to go with a boolean. I am fine either way, staying consistent with a boolean or doing a more fine-grained project id list (if required by python client usage).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tswast reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@tswast
Merge branch 'main' into issue589-query_and_wait
4ffec17
@tswast tswast mentioned this pull request Dec 6, 2023
dbapi: Skip storage client fetch when results cached #1745
Closed
tswast added 2 commits December 7, 2023 10:05
@tswast
Merge remote-tracking branch 'origin/main' into issue589-query_and_wait
95b3b0e
@tswast
fix: keep RowIterator.total_rows populated after iteration
f08dac3
This was being reset in some cases when
the rows were all available in the
first page of results.
@tswast tswast mentioned this pull request Dec 8, 2023
fix: keep RowIterator.total_rows populated after iteration #1748
Merged
4 tasks
chalmerlowe
chalmerlowe reviewed Dec 8, 2023
View reviewed changes
Comment thread google/cloud/bigquery/_job_helpers.py Outdated
if default_job_config is None:
return job_config

# anything that's not defined on the incoming

@chalmerlowe chalmerlowe Dec 8, 2023

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This comment is a bit unclear. Can we clean this up a bit?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
chalmerlowe
chalmerlowe reviewed Dec 8, 2023
View reviewed changes
Comment thread google/cloud/bigquery/_job_helpers.py Outdated
# should be filled in with the default
# the incoming therefore has precedence
#
# Note that _fill_from_default doesn't mutate the receiver

@chalmerlowe chalmerlowe Dec 8, 2023

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

For my own edification, what do we mean by "receiver"?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tswast @parthea
Update google/cloud/bigquery/table.py
a376bd6
Co-authored-by: Anthonios Partheniou <[email protected]>
chalmerlowe
chalmerlowe approved these changes Dec 8, 2023
View reviewed changes

@chalmerlowe chalmerlowe left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM. Please address minor comments.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
tswast added 4 commits December 8, 2023 15:38
@tswast
Merge remote-tracking branch 'origin/issue589-query_and_wait' into is…
7c3d813
…sue589-query_and_wait
@tswast
Merge remote-tracking branch 'origin/issue589-total_rows' into issue5…
304799a
…89-query_and_wait
@tswast
fix comments
425f6b0
@tswast
Merge branch 'main' into issue589-query_and_wait
ae06cd2
@tswast
tswast enabled auto-merge (squash) December 8, 2023 22:14
@tswast
tswast merged commit 89a647e into main Dec 8, 2023
@tswast
tswast deleted the issue589-query_and_wait branch December 8, 2023 22:46
@release-please release-please Bot mentioned this pull request Dec 8, 2023
chore(main): release 3.14.0 #1709
Merged
This was referenced Dec 19, 2023
December 18, 2023 kitta65/bq-extension-vscode#262
Closed
December 18, 2023 kitta65/prettier-plugin-bq#269
Closed
December 18, 2023 kitta65/bq2cst#279
Closed
@davidkell davidkell mentioned this pull request Dec 19, 2023
Postgres gyana/gyana#1494
Merged
24 of 25 tasks
@tswast tswast mentioned this pull request Apr 25, 2024
ci(bigquery): bigquery ci is very slow ibis-project/ibis#8987
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@obada-ab obada-ab Awaiting requested review from obada-ab
@m-strzelczyk m-strzelczyk Awaiting requested review from m-strzelczyk m-strzelczyk is a code owner automatically assigned from googleapis/python-samples-owners
2 more reviewers
@mmladenovski mmladenovski mmladenovski approved these changes
@chalmerlowe chalmerlowe chalmerlowe approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

api: bigquery Issues related to the googleapis/python-bigquery API. size: xl Pull request size is extra large.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@tswast @mmladenovski @chalmerlowe @yoshi-kokoro
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.