Skip to content

Commit

Permalink
feat: surface retry param to Table.read_row api
Browse files Browse the repository at this point in the history
  • Loading branch information
ayubun committed Oct 25, 2024
1 parent c573e9b commit 39e8f90
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions google/cloud/bigtable/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ def get_encryption_info(self):
for cluster_id, value_pb in table_pb.cluster_states.items()
}

def read_row(self, row_key, filter_=None):
def read_row(self, row_key, filter_=None, retry=DEFAULT_RETRY_READ_ROWS):
"""Read a single row from this table.
For example:
Expand All @@ -550,6 +550,14 @@ def read_row(self, row_key, filter_=None):
:param filter_: (Optional) The filter to apply to the contents of the
row. If unset, returns the entire row.
:type retry: :class:`~google.api_core.retry.Retry`
:param retry:
(Optional) Retry delay and deadline arguments. To override, the
default value :attr:`DEFAULT_RETRY_READ_ROWS` can be used and
modified with the :meth:`~google.api_core.retry.Retry.with_delay`
method or the :meth:`~google.api_core.retry.Retry.with_deadline`
method.
:rtype: :class:`.PartialRowData`, :data:`NoneType <types.NoneType>`
:returns: The contents of the row if any chunks were returned in
the response, otherwise :data:`None`.
Expand All @@ -558,7 +566,9 @@ def read_row(self, row_key, filter_=None):
"""
row_set = RowSet()
row_set.add_row_key(row_key)
result_iter = iter(self.read_rows(filter_=filter_, row_set=row_set))
result_iter = iter(
self.read_rows(filter_=filter_, row_set=row_set, retry=retry)
)
row = next(result_iter, None)
if next(result_iter, None) is not None:
raise ValueError("More than one row was returned.")
Expand Down

0 comments on commit 39e8f90

Please sign in to comment.