-
Notifications
You must be signed in to change notification settings - Fork 1
fix(bigquery): fix start index with page size for list rows #107
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
base: master
Are you sure you want to change the base?
Conversation
IlyaFaer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate line should be deleted, other comments are not much of a major
| self._preserve_order = False | ||
| self._project = client.project | ||
| self._schema = schema | ||
| self._schema = schema |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplication
| params = self._get_query_params() | ||
| if self._page_size is not None: | ||
| if self.page_number != 0 and "startIndex" in params: | ||
| del params["startIndex"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, we could write if self.page_number instead of if self.page_number != 0. Page number is not gonna be negative, so this if-statement will be giving True in all cases except self.page_number == 0. And it's little bit shorter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I need to delete startIndex from query parameter after first request so when first request hit at that time page_num is 0 and after it increments so except page 0 need to delete for every request.
| {"f": [{"v": "Wylma Phlyntstone"}]}, | ||
| {"f": [{"v": "Bhettye Rhubble"}]}, | ||
| ], | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
page_1 and page_2 are constants, I believe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes this is the response with pages.
bigquery/tests/unit/test_client.py
Outdated
| self.assertEqual(rows[1], Row(("Bharney Rhubble",), f2i)) | ||
|
|
||
| second_page = six.next(pages) | ||
| rows = list(second_page) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would write in this way:
rows = list(six.next(pages))
As second_page var looks excess
mf2199
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM aside of @IlyaFaer remarks.
IPR [10184]