Skip to content
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

BigQuery: Complete the to_arrow() method feature request #8693

Merged
merged 4 commits into from
Jul 17, 2019

Conversation

plamut
Copy link
Contributor

@plamut plamut commented Jul 17, 2019

Closes #5204.

This PR adds the last missing piece of the feature, i.e. the bqstorage_client parameter that was still missing from one of the methods.

How to test

Check that the signatures for various to_arrow() methods match (and the same for the to_dataframe() methods).

plamut added 3 commits July 17, 2019 16:00
The method signatures for to_arrow() and to_dataframe() methods in the
job.QueryJob and table.RowIterator classes must match to present a
consistent API for users.
@plamut plamut added the api: bigquery Issues related to the BigQuery API. label Jul 17, 2019
@plamut plamut requested review from tswast and a team July 17, 2019 14:58
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 17, 2019
inspect.signature() method is only available in older Python versions
@@ -2896,7 +2896,9 @@ def result(self, timeout=None, page_size=None, retry=DEFAULT_RETRY):
rows._preserve_order = _contains_order_by(self.query)
return rows

def to_arrow(self, progress_bar_type=None):
# If changing the signature of this method, make sure to apply the same
# changes to table.RowIterator.to_arrow()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note - this and the other similar comments might be redundant now that we have a test for method signatures, but I personally don't mind having them, as it makes the contract between the two classes more explicit.

def test_to_arrow_method_signatures_match(query_job_class, row_iterator_class):
sig = inspect.signature(query_job_class.to_arrow)
sig2 = inspect.signature(row_iterator_class.to_arrow)
assert sig == sig2
Copy link
Contributor

Choose a reason for hiding this comment

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

Love this! ❤️ Thanks for the test. I wouldn't have thought to try this.

@tswast tswast assigned plamut and tswast and unassigned tswast and plamut Jul 17, 2019
@tswast tswast merged commit 562deea into googleapis:master Jul 17, 2019
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 BigQuery API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BigQuery: to_arrow() method similar to to_dataframe()
3 participants