-
Notifications
You must be signed in to change notification settings - Fork 1.6k
BigTable: Adding a row generator on a table. #4679
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
Conversation
… rows in a table instead of reading the rows into an internal dictionary first. As soon as a row has been validated, it is available in the iterator, by using yield in the generator.
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
@@ -194,8 +194,66 @@ class PartialRowsData(object): | |||
|
|||
def __init__(self, response_iterator): | |||
self._response_iterator = response_iterator | |||
self.generator = YieldRowsData(response_iterator) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
||
def __eq__(self, other): | ||
if not isinstance(other, self.__class__): | ||
return False |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
return other._response_iterator == self._response_iterator | ||
|
||
def __ne__(self, other): | ||
return not self.__eq__(other) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
""" | ||
# NOTE: To avoid duplicating large objects, this is just the | ||
# mutable private data. | ||
return self._rows |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
:param response_iterator: A streaming iterator returned from a | ||
``ReadRows`` request. | ||
""" | ||
START = "Start" # No responses yet processed. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
def state(self): | ||
"""State machine state. | ||
|
||
:rtype: str |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -425,18 +451,9 @@ def _copy_from_previous(self, cell): | |||
cell.row_key = previous.row_key | |||
if not cell.family_name: | |||
cell.family_name = previous.family_name | |||
# NOTE: ``cell.qualifier`` **can** be empty string. | |||
if cell.qualifier is None: | |||
if not cell.qualifier: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
bigtable/tests/unit/test_row_data.py
Outdated
@@ -189,117 +189,85 @@ def test_row_key_getter(self): | |||
|
|||
|
|||
class TestPartialRowsData(unittest.TestCase): | |||
@staticmethod |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
bigtable/tests/unit/test_row_data.py
Outdated
|
||
@staticmethod | ||
def _get_target_class(): | ||
def _get_partial_target_class(): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Since |
Not until |
All review requests made but not finding a solution for providing unit tests that provide coverage of iterator / generator code. Please provide any suggestions for this so this can be completed. |
…le-cloud-python into feature/row_iterator
@zakons The output on CircleCI is To mitigate: the branch is the test |
Thanks! |
So, guess which breaking change didn't get mentioned in the release notes? ;) Also, the documentation is now out-of-date, so it ended up taking some source diving to figure out how to use the new code. I think this means that |
Adding a row generator on a table. This will allow iteration over the rows in a table instead of reading the rows into an internal dictionary first. As soon as a row has been validated, it is available in the iterator, by adding a row generator on a table. This will allow iteration over the rows in a table instead of reading the rows into an internal dictionary first. As soon as a row has been validated, it is available in the iterator, by using yield in the generator. The read_rows() method on table will still return PartialRowsData, and consume_all() will now use the row generator to process the ReadRowsResponses to populate the rows or in an internal dictionary. The yield_rows() method on table provides a row iterator and does not store any of the rows internally. The rows are available as soon as they are read from the channel and validated.
Closes #4586.