Skip to content

fix(bigquery): pass timeout to the table lookup when loading dataframes and JSON - #18937

Open
abhishekacharya200 wants to merge 1 commit into
googleapis:mainfrom
abhishekacharya200:fix/bigquery-load-lookup-timeout
Open

abhishekacharya200 wants to merge 1 commit into
googleapis:mainfrom
abhishekacharya200:fix/bigquery-load-lookup-timeout

Conversation

@abhishekacharya200

Copy link
Copy Markdown
Contributor

Fixes #18936

load_table_from_dataframe and load_table_from_json take a timeout, but the get_table(destination) call they make before uploading didn't receive it. BigQuery's DEFAULT_TIMEOUT is None, so that request had no timeout at all and could hang however short a timeout the caller set.

This passes timeout to both lookups. Callers who don't set one still get None, as before. Both methods type timeout as ResumableTimeoutType, which can be a (connect, read) tuple; get_table hands it to the same HTTP layer, so a tuple works there too, though the tests only use a float.

Added test_load_table_from_dataframe_passes_timeout_to_table_lookup and test_load_table_from_json_passes_timeout_to_table_lookup, which fail on main and pass with this change. tests/unit/test_client.py passes (285 passed, 1 skipped). black 23.7.0 and flake8 report nothing on the changed files.

This is the same gap as #18767, in two other methods, and the two PRs don't touch the same lines.

…taframe and load_table_from_json

Both methods call get_table before uploading, without the caller's
timeout. BigQuery's default timeout is None, so that request could hang
however short a timeout was set.
@abhishekacharya200
abhishekacharya200 requested review from a team as code owners October 31, 2026 13:07
@abhishekacharya200
abhishekacharya200 requested review from sycai and removed request for a team October 31, 2026 13:07

@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 ensures that the timeout parameter is correctly passed to the get_table lookup in both load_table_from_dataframe and load_table_from_json methods of the BigQuery client. Corresponding unit tests have been added to verify this behavior. I have no feedback to provide as there are no review comments.

This branch has not been deployed

No deployments
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.

bigquery: load_table_from_dataframe and load_table_from_json drop timeout on the table lookup

1 participant