-
Notifications
You must be signed in to change notification settings - Fork 0
feat(bigtable): add support read row by prefix #3
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?
Changes from all commits
4e61e15
7e38276
57e59b7
909ba28
9255ab3
2a7e5ac
8c6372e
9f6fc65
1e92f4f
4f93887
918e6cb
434577c
470f60d
49e3dbd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,6 +112,24 @@ def add_row_range_from_keys( | |
| row_range = RowRange(start_key, end_key, start_inclusive, end_inclusive) | ||
| self.row_ranges.append(row_range) | ||
|
|
||
| def add_row_range_with_prefix(self, row_key_prefix): | ||
| """Add row range to row_ranges list that start with the row_key_prefix from the row keys | ||
|
|
||
| For example: | ||
|
|
||
| .. literalinclude:: snippets_table.py | ||
| :start-after: [START bigtable_add_row_range_with_prefix] | ||
| :end-before: [END bigtable_add_row_range_with_prefix] | ||
|
|
||
| :type row_key_prefix: str | ||
| :param row_key_prefix: To retrieve all rows that start with this row key prefix. | ||
| Prefix cannot be zero length.""" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incorrect indentation, and the comment doesn't seem to be very understandable.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so it's indentation problem as you can see below |
||
|
|
||
| end_key = row_key_prefix[:-1] + chr(ord(row_key_prefix[-1]) + 1) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That seems strange. If you'll pass "row" (as you did in your sample), you'll get "rox". What it should mean? In Billy's example there is a "#" symbol. After +1 it'll become "$" which is the "end of line" regex symbol. It sound logical, but incrementing the code of the last symbol overall doesn't seem correct to me.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Following links of integration test : |
||
| self.add_row_range_from_keys( | ||
| row_key_prefix.encode("utf-8"), end_key.encode("utf-8") | ||
| ) | ||
|
|
||
| def _update_message_request(self, message): | ||
| """Add row keys and row range to given request message | ||
|
|
||
|
|
||
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.
To retrieve all rows that start with this row key prefix.The grammar here can be improved.