Skip to content

chore: fix AttributeError when rowiterator has no attribute in g3 #1709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

chelsea-lin
Copy link
Contributor

When updating BigQuery DataFrames in g3, an AttributeError occurs when accessing the total_bytes_processed and query attributes of RowIterator. This is because g3 does not have an up-to-date Python client library. Here is the error message: https://screenshot.googleplex.com/4GhbZBdFZrVrCwA

@chelsea-lin chelsea-lin requested review from a team as code owners May 8, 2025 00:57
@chelsea-lin chelsea-lin requested a review from drylks-work May 8, 2025 00:57
@product-auto-label product-auto-label bot added the size: xs Pull request size is extra small. label May 8, 2025
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. label May 8, 2025
@chelsea-lin chelsea-lin requested review from tswast and GarrettWu May 8, 2025 00:58
if (row_iterator.total_bytes_processed is None) or (
row_iterator.query is None
if (
not hasattr(row_iterator, "total_bytes_processed")
Copy link
Collaborator

Choose a reason for hiding this comment

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

When was this attribute added? It seems to me this isn't just a "chore: " but a true bug fix for being incompatible with older google-cloud-bigquery library.

Please add a unit test and make sure it fails on at least one nox session before this fix is added.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, the version is very old internally. I still think it'd be good to make sure we have tested against this version, but that might be too much for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As we discussed offline, this change is not necessary for github because the setup.py asks google-cloud-bigquery>=3.31.0, but only needed for g3, which has lower version. The alternative solution would upgrade g3 version and this PR can be a short-term solution to unblock BF g3 import.

if (row_iterator.total_bytes_processed is None) or (
row_iterator.query is None
if (
not hasattr(row_iterator, "total_bytes_processed")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, the version is very old internally. I still think it'd be good to make sure we have tested against this version, but that might be too much for this PR.

@chelsea-lin chelsea-lin force-pushed the main_chelsealin_g3merge branch from bd07fec to 7c38439 Compare May 8, 2025 18:11
@product-auto-label product-auto-label bot added size: s Pull request size is small. and removed size: xs Pull request size is extra small. labels May 8, 2025
@chelsea-lin chelsea-lin force-pushed the main_chelsealin_g3merge branch from 7c38439 to a179898 Compare May 8, 2025 18:20
@chelsea-lin chelsea-lin requested a review from tswast May 8, 2025 18:59
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 googleapis/python-bigquery-dataframes API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants