Skip to content
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

feat: surface retry param to Table.read_row api #982

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading