Skip to content

docs(bigquery): update load_table_dataframe code sample to use BigFrames - #18036

Draft
shuoweil wants to merge 1 commit into
mainfrom
shuowei-fix-client-info-metadat-test
Draft

docs(bigquery): update load_table_dataframe code sample to use BigFrames#18036
shuoweil wants to merge 1 commit into
mainfrom
shuowei-fix-client-info-metadat-test

Conversation

@shuoweil

@shuoweil shuoweil commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Updates the bigquery_load_table_dataframe code sample (which powers cloud.google.com/bigquery/docs/samples/bigquery-load-table-dataframe) to use BigQuery DataFrames (bigframes) instead of the legacy client.load_table_from_dataframe API.

Fixes #<522898394> 🦕

@shuoweil shuoweil self-assigned this Aug 8, 2026
@shuoweil
shuoweil requested review from a team as code owners August 8, 2026 00:26
@shuoweil
shuoweil requested review from sycai and removed request for a team and sycai August 8, 2026 00:26
@shuoweil
shuoweil marked this pull request as draft August 8, 2026 00:27

@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 refactors the test_init_default_client_info unit test in test_read_client_v1.py to mock wrap_method and verify that the client info is correctly passed and formatted. Feedback was provided to rename the local variable client_info to avoid shadowing the imported module of the same name.

Comment on lines +168 to +171
for call in mock_wrap.call_args_list:
client_info = call.kwargs.get("client_info")
assert client_info is not None
assert expected_client_info in client_info.to_user_agent()

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.

medium

The local variable name client_info shadows the client_info module imported at the top of the file (line 20). To avoid confusion and improve code maintainability, rename the local variable to c_info.

Suggested change
for call in mock_wrap.call_args_list:
client_info = call.kwargs.get("client_info")
assert client_info is not None
assert expected_client_info in client_info.to_user_agent()
for call in mock_wrap.call_args_list:
c_info = call.kwargs.get("client_info")
assert c_info is not None
assert expected_client_info in c_info.to_user_agent()

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.

1 participant