feat(bigtable): add support read row by prefix#3
Conversation
| read_rows = table.read_rows(row_set=row_set) | ||
| expected_row_keys = [ | ||
| b"row_key_1", | ||
| b"row_key_2", | ||
| b"row_key_3", | ||
| b"row_key_4", | ||
| b"row_key_5", | ||
| b"row_key_6", | ||
| b"row_key_7", | ||
| b"row_key_8", | ||
| b"row_key_9", | ||
| ] | ||
| found_row_keys = [row.row_key for row in read_rows] |
There was a problem hiding this comment.
IMO, a more elegant and concise way would be
expected_row_keys = [b"row_key_%x" % i for i in range(1, 10)]
found_row_keys = [row.row_key for row in table.read_rows(row_set=row_set)]
There was a problem hiding this comment.
Yes , correct but they have declare static before in snippets and system file so ta make consistent i made this static.
|
|
||
| :type row_key_prefix: str | ||
| :param row_key_prefix: Add all rows that start with this row key prefix. | ||
| Prefix cannot be zero length.""" |
There was a problem hiding this comment.
Incorrect indentation, and the comment doesn't seem to be very understandable.
There was a problem hiding this comment.
I don't think so it's indentation problem as you can see below
https://github.com/q-logic/python-bigtable/blob/1d92cc2e3c6dad83e505438b2e0ebdf0a483fbdf/google/cloud/bigtable/row_set.py#L101-L107
| :param row_key_prefix: Add all rows that start with this row key prefix. | ||
| Prefix cannot be zero length.""" | ||
|
|
||
| end_key = row_key_prefix[:-1] + chr(ord(row_key_prefix[-1]) + 1) |
There was a problem hiding this comment.
That seems strange. If you'll pass "row" (as you did in your sample), you'll get "rox". What it should mean?
Sounds to me, in this variable we should have a name of the key on which we'd like to stop fetching data from table.
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.
There was a problem hiding this comment.
# and $ doesn't work here we need to remove manually , Please see the implementation of prefix in go and node:
Following links of integration test :
Go: https://github.com/googleapis/google-cloud-go/blob/51eb5ee54e44743973ca6a638660fd1067b17365/bigtable/integration_test.go#L673
|
|
||
| :type row_key_prefix: str | ||
| :param row_key_prefix: Add all rows that start with this row key prefix. | ||
| :param row_key_prefix: To retrieve all rows that start with this row key prefix. |
There was a problem hiding this comment.
To retrieve all rows that start with this row key prefix.
The grammar here can be improved.
…into bigtable_issue_24
…into bigtable_issue_24
…into bigtable_issue_24
…into bigtable_issue_24
…into bigtable_issue_24
…into bigtable_issue_24
…into bigtable_issue_24
…into bigtable_issue_24
Fixes [24]