fix: handle AttributeError in bigquery_storage writer by parthea · Pull Request #414 · googleapis/python-bigquery-storage · GitHub
Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

fix: handle AttributeError in bigquery_storage writer#414

Merged
parthea merged 8 commits into
mainfrom
handle-null-rpc-and-consumer
Jun 24, 2022
Merged

fix: handle AttributeError in bigquery_storage writer#414
parthea merged 8 commits into
mainfrom
handle-null-rpc-and-consumer

Conversation

@parthea

@parthea parthea commented Mar 14, 2022

Copy link
Copy Markdown
Contributor

This PR fixes an issue where an AttributeError could be raised here if either self._rpc or the self._consumer is null. @tswast and I saw this AttributeError locally with the changes from googleapis/python-api-core#357

See stack trace below

Exception has occurred: AttributeError
'NoneType' object has no attribute 'is_active'
  File "[/usr/local/google/home/partheniou/git/python-bigquery-storage/google/cloud/bigquery_storage_v1/writer.py]()", line 192, in _open
    while not self._rpc.is_active and self._consumer.is_active:
  File "[/usr/local/google/home/partheniou/git/python-bigquery-storage/google/cloud/bigquery_storage_v1/writer.py]()", line 230, in send
    return self._open(request)
  File "[/usr/local/google/home/partheniou/git/python-bigquery-storage/samples/snippets/append_rows_proto2.py]()", line 123, in append_rows_proto2
    response_future_1 = append_rows_stream.send(request)
  File "[/usr/local/google/home/partheniou/git/python-bigquery-storage/samples/snippets/append_rows_proto2_test.py]()", line 58, in test_append_rows_proto2
    append_rows_proto2.append_rows_proto2(

@parthea parthea requested review from a team and stephaniewang526 March 14, 2022 21:05
@product-auto-label product-auto-label Bot added the api: bigquerystorage Issues related to the googleapis/python-bigquery-storage API. label Mar 14, 2022
@parthea parthea force-pushed the handle-null-rpc-and-consumer branch from 3956003 to fc2b386 Compare March 14, 2022 21:06
@parthea parthea changed the title fix: resolve issue AttributeError in bigquery_storage writer fix: resolve AttributeError in bigquery_storage writer Mar 14, 2022
tswast
tswast previously requested changes Mar 15, 2022
Comment thread google/cloud/bigquery_storage_v1/writer.py Outdated
@parthea parthea changed the title fix: resolve AttributeError in bigquery_storage writer fix: handle AttributeError in bigquery_storage writer Mar 15, 2022
@parthea parthea requested a review from tswast March 15, 2022 15:33
@parthea parthea added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Mar 15, 2022
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Mar 15, 2022

@tswast tswast 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.

Looks good! Would be great if we could get a unit test or two checking this behavior (closed during _open)

@meredithslota meredithslota requested review from steffnay and removed request for stephaniewang526 May 13, 2022 15:33
@product-auto-label product-auto-label Bot added the size: m Pull request size is medium. label Jun 13, 2022
@parthea

parthea commented Jun 13, 2022

Copy link
Copy Markdown
Contributor Author

@parthea

parthea commented Jun 13, 2022

Copy link
Copy Markdown
Contributor Author

@parthea parthea requested a review from tswast June 13, 2022 23:29
@parthea parthea assigned loferris and unassigned tswast Jun 13, 2022
@parthea parthea requested a review from loferris June 13, 2022 23:29
@parthea parthea dismissed tswast’s stale review June 24, 2022 15:30

Dismiss stale review

@parthea parthea merged commit 2cb641a into main Jun 24, 2022
@parthea parthea deleted the handle-null-rpc-and-consumer branch June 24, 2022 15:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: bigquerystorage Issues related to the googleapis/python-bigquery-storage API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants