From dd4a87b33092d7ac4e5efd6affdf1ac8482d2626 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 8 Aug 2024 16:26:38 -0700 Subject: [PATCH 01/22] added new docs pages --- .../async_data_client/async_data_execute_query_iterator.rst | 6 ++++++ .../async_data_client/async_data_execute_query_metadata.rst | 6 ++++++ docs/async_data_client/async_data_execute_query_values.rst | 6 ++++++ docs/async_data_client/async_data_usage.rst | 3 +++ 4 files changed, 21 insertions(+) create mode 100644 docs/async_data_client/async_data_execute_query_iterator.rst create mode 100644 docs/async_data_client/async_data_execute_query_metadata.rst create mode 100644 docs/async_data_client/async_data_execute_query_values.rst diff --git a/docs/async_data_client/async_data_execute_query_iterator.rst b/docs/async_data_client/async_data_execute_query_iterator.rst new file mode 100644 index 000000000..f9f7af074 --- /dev/null +++ b/docs/async_data_client/async_data_execute_query_iterator.rst @@ -0,0 +1,6 @@ +Execute Query Iterator +~~~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: google.cloud.bigtable.data.execute_query.ExecuteQueryIteratorAsync + :members: + :show-inheritance: diff --git a/docs/async_data_client/async_data_execute_query_metadata.rst b/docs/async_data_client/async_data_execute_query_metadata.rst new file mode 100644 index 000000000..69add630d --- /dev/null +++ b/docs/async_data_client/async_data_execute_query_metadata.rst @@ -0,0 +1,6 @@ +Execute Query Metadata +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: google.cloud.bigtable.data.execute_query.metadata + :members: + :show-inheritance: diff --git a/docs/async_data_client/async_data_execute_query_values.rst b/docs/async_data_client/async_data_execute_query_values.rst new file mode 100644 index 000000000..6c4fb71c1 --- /dev/null +++ b/docs/async_data_client/async_data_execute_query_values.rst @@ -0,0 +1,6 @@ +Execute Query Values +~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: google.cloud.bigtable.data.execute_query.values + :members: + :show-inheritance: diff --git a/docs/async_data_client/async_data_usage.rst b/docs/async_data_client/async_data_usage.rst index 8843b506b..61d5837fd 100644 --- a/docs/async_data_client/async_data_usage.rst +++ b/docs/async_data_client/async_data_usage.rst @@ -13,3 +13,6 @@ Async Data Client async_data_mutations async_data_read_modify_write_rules async_data_exceptions + async_data_execute_query_iterator + async_data_execute_query_values + async_data_execute_query_metadata From aa66d7d4a2e7538c989919b96ceb157324f96f08 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 8 Aug 2024 16:26:51 -0700 Subject: [PATCH 02/22] fixed broken formatting --- .../data/execute_query/_async/execute_query_iterator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py b/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py index 3660c0b0f..bb4634657 100644 --- a/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py +++ b/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py @@ -47,7 +47,7 @@ class ExecuteQueryIteratorAsync: """ ExecuteQueryIteratorAsync handles collecting streaming responses from the - ExecuteQuery RPC and parsing them to `QueryResultRow`s. + ExecuteQuery RPC and parsing them to QueryResultRows. ExecuteQueryIteratorAsync implements Asynchronous Iterator interface and can be used with "async for" syntax. It is also a context manager. From 6bac9bd47933706d0cc0c5b192eb770dfe9de77f Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 8 Aug 2024 16:48:42 -0700 Subject: [PATCH 03/22] fix class reference --- docs/async_data_client/async_data_execute_query_iterator.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/async_data_client/async_data_execute_query_iterator.rst b/docs/async_data_client/async_data_execute_query_iterator.rst index f9f7af074..d53be275b 100644 --- a/docs/async_data_client/async_data_execute_query_iterator.rst +++ b/docs/async_data_client/async_data_execute_query_iterator.rst @@ -1,6 +1,6 @@ Execute Query Iterator ~~~~~~~~~~~~~~~~~~~~~~ -.. automodule:: google.cloud.bigtable.data.execute_query.ExecuteQueryIteratorAsync +.. autoclass:: google.cloud.bigtable.data.execute_query.ExecuteQueryIteratorAsync :members: :show-inheritance: From 9c027a10f69fcadc01a95edc195d43665a1b610c Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 8 Aug 2024 16:48:54 -0700 Subject: [PATCH 04/22] improved iterator docstrings --- .../_async/execute_query_iterator.py | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py b/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py index bb4634657..ff01f1edd 100644 --- a/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py +++ b/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py @@ -55,18 +55,20 @@ class ExecuteQueryIteratorAsync: It is **not thread-safe**. It should not be used by multiple asyncio Tasks. Args: - client (google.cloud.bigtable.data._async.BigtableDataClientAsync): bigtable client - instance_id (str): id of the instance on which the query is executed - request_body (Dict[str, Any]): dict representing the body of the ExecuteQueryRequest - attempt_timeout (float | None): the time budget for the entire operation, in seconds. - Failed requests will be retried within the budget. - Defaults to 600 seconds. - operation_timeout (float): the time budget for an individual network request, in seconds. - If it takes longer than this time to complete, the request will be cancelled with - a DeadlineExceeded exception, and a retry will be attempted. - Defaults to the 20 seconds. If None, defaults to operation_timeout. - req_metadata (Sequence[Tuple[str, str]]): metadata used while sending the gRPC request - retryable_excs (List[type[Exception]]): a list of errors that will be retried if encountered. + client (google.cloud.bigtable.data.BigtableDataClientAsync): bigtable client + instance_id (str): id of the instance on which the query is executed + request_body (Dict[str, Any]): dict representing the body of the ExecuteQueryRequest + attempt_timeout (float | None): the time budget for the entire operation, in seconds. + Failed requests will be retried within the budget. + Defaults to 600 seconds. + operation_timeout (float): the time budget for an individual network request, in seconds. + If it takes longer than this time to complete, the request will be cancelled with + a DeadlineExceeded exception, and a retry will be attempted. + Defaults to the 20 seconds. If None, defaults to operation_timeout. + req_metadata (Sequence[Tuple[str, str]]): metadata used while sending the gRPC request + retryable_excs (List[type[Exception]]): a list of errors that will be retried if encountered. + Raises: + RuntimeError: if the instance is not created within an async event loop context. """ def __init__( @@ -113,14 +115,17 @@ def __init__( @property def is_closed(self): + """Returns True if the iterator is closed, False otherwise.""" return self._is_closed @property def app_profile_id(self): + """Returns the app_profile_id of the iterator.""" return self._app_profile_id @property def table_name(self): + """Returns the table_name of the iterator.""" return self._table_name async def _make_request_with_resume_token(self): From 395394c2e5801bdd20f5f23b56cbe83323054d02 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 8 Aug 2024 16:54:54 -0700 Subject: [PATCH 05/22] use client instead of any type --- .../data/execute_query/_async/execute_query_iterator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py b/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py index ff01f1edd..2c185be50 100644 --- a/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py +++ b/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py @@ -23,6 +23,7 @@ Optional, Sequence, Tuple, + TYPE_CHECKING ) from google.api_core import retry as retries @@ -43,6 +44,8 @@ ExecuteQueryRequest as ExecuteQueryRequestPB, ) +if TYPE_CHECKING: + from google.cloud.bigtable.data import BigtableDataClientAsync class ExecuteQueryIteratorAsync: """ @@ -73,7 +76,7 @@ class ExecuteQueryIteratorAsync: def __init__( self, - client: Any, + client: BigtableDataClientAsync, instance_id: str, app_profile_id: Optional[str], request_body: Dict[str, Any], From e8a1ba8e2bfd9a62b6f05a729b298f8cfd4b7e60 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 8 Aug 2024 17:01:30 -0700 Subject: [PATCH 06/22] added type annotations --- .../data/execute_query/_async/execute_query_iterator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py b/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py index 2c185be50..633850a3a 100644 --- a/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py +++ b/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py @@ -117,17 +117,17 @@ def __init__( ) from e @property - def is_closed(self): + def is_closed(self) -> bool: """Returns True if the iterator is closed, False otherwise.""" return self._is_closed @property - def app_profile_id(self): + def app_profile_id(self) -> Optional[str]: """Returns the app_profile_id of the iterator.""" return self._app_profile_id @property - def table_name(self): + def table_name(self) -> Optional[str]: """Returns the table_name of the iterator.""" return self._table_name From 6be03fd9a081ffd36aeb58ee28ab665b4fcbd979 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 8 Aug 2024 17:14:28 -0700 Subject: [PATCH 07/22] add async to title --- docs/async_data_client/async_data_execute_query_iterator.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/async_data_client/async_data_execute_query_iterator.rst b/docs/async_data_client/async_data_execute_query_iterator.rst index d53be275b..b911fab7f 100644 --- a/docs/async_data_client/async_data_execute_query_iterator.rst +++ b/docs/async_data_client/async_data_execute_query_iterator.rst @@ -1,5 +1,5 @@ -Execute Query Iterator -~~~~~~~~~~~~~~~~~~~~~~ +Execute Query Iterator Async +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. autoclass:: google.cloud.bigtable.data.execute_query.ExecuteQueryIteratorAsync :members: From c2640f145cdaadcb6becbb784440a855f2e3b29c Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 8 Aug 2024 17:14:42 -0700 Subject: [PATCH 08/22] standardize client docstring --- google/cloud/bigtable/data/_async/client.py | 22 ++++++++++----------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/google/cloud/bigtable/data/_async/client.py b/google/cloud/bigtable/data/_async/client.py index 600937df8..d5ae514ab 100644 --- a/google/cloud/bigtable/data/_async/client.py +++ b/google/cloud/bigtable/data/_async/client.py @@ -456,38 +456,36 @@ async def execute_query( retryable_errors list until operation_timeout is reached. Args: - - query: Query to be run on Bigtable instance. The query can use ``@param`` + query: Query to be run on Bigtable instance. The query can use ``@param`` placeholders to use parameter interpolation on the server. Values for all parameters should be provided in ``parameters``. Types of parameters are inferred but should be provided in ``parameter_types`` if the inference is not possible (i.e. when value can be None, an empty list or an empty dict). - - instance_id: The Bigtable instance ID to perform the query on. + instance_id: The Bigtable instance ID to perform the query on. instance_id is combined with the client's project to fully specify the instance. - - parameters: Dictionary with values for all parameters used in the ``query``. - - parameter_types: Dictionary with types of parameters used in the ``query``. + parameters: Dictionary with values for all parameters used in the ``query``. + parameter_types: Dictionary with types of parameters used in the ``query``. Required to contain entries only for parameters whose type cannot be detected automatically (i.e. the value can be None, an empty list or an empty dict). - - app_profile_id: The app profile to associate with requests. + app_profile_id: The app profile to associate with requests. https://cloud.google.com/bigtable/docs/app-profiles - - operation_timeout: the time budget for the entire operation, in seconds. + operation_timeout: the time budget for the entire operation, in seconds. Failed requests will be retried within the budget. Defaults to 600 seconds. - - attempt_timeout: the time budget for an individual network request, in seconds. + attempt_timeout: the time budget for an individual network request, in seconds. If it takes longer than this time to complete, the request will be cancelled with a DeadlineExceeded exception, and a retry will be attempted. Defaults to the 20 seconds. If None, defaults to operation_timeout. - - retryable_errors: a list of errors that will be retried if encountered. + retryable_errors: a list of errors that will be retried if encountered. Defaults to 4 (DeadlineExceeded), 14 (ServiceUnavailable), and 10 (Aborted) Returns: - - an asynchronous iterator that yields rows returned by the query - Raises: - - DeadlineExceeded: raised after operation timeout + google.api_core.exceptions.DeadlineExceeded: raised after operation timeout will be chained with a RetryExceptionGroup containing GoogleAPIError exceptions from any retries that failed - - GoogleAPIError: raised if the request encounters an unrecoverable error + google.api_core.exceptions.GoogleAPIError: raised if the request encounters an unrecoverable error """ warnings.warn( "ExecuteQuery is in preview and may change in the future.", From a0d9f71294b15ea532928a4bbeed0486e357b10d Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 8 Aug 2024 17:15:01 -0700 Subject: [PATCH 09/22] add minimal docstrings to metadata classes --- .../bigtable/data/execute_query/metadata.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/google/cloud/bigtable/data/execute_query/metadata.py b/google/cloud/bigtable/data/execute_query/metadata.py index 4c08cbad3..531446cab 100644 --- a/google/cloud/bigtable/data/execute_query/metadata.py +++ b/google/cloud/bigtable/data/execute_query/metadata.py @@ -90,6 +90,7 @@ def __repr__(self) -> str: return self.__str__() class Struct(_NamedList[Type], Type): + """Struct SQL type.""" @classmethod def from_pb_type(cls, type_pb: Optional[PBType] = None) -> "SqlType.Struct": if type_pb is None: @@ -120,6 +121,7 @@ def __str__(self): return super(_NamedList, self).__str__() class Array(Type): + """Array SQL type.""" def __init__(self, element_type: "SqlType.Type"): if isinstance(element_type, SqlType.Array): raise ValueError("Arrays of arrays are not supported.") @@ -148,6 +150,7 @@ def __str__(self) -> str: return f"{self.__class__.__name__}<{str(self.element_type)}>" class Map(Type): + """Map SQL type.""" def __init__(self, key_type: "SqlType.Type", value_type: "SqlType.Type"): self._key_type = key_type self._value_type = value_type @@ -189,32 +192,39 @@ def __str__(self) -> str: ) class Bytes(Type): + """Bytes SQL type.""" expected_type = bytes value_pb_dict_field_name = "bytes_value" type_field_name = "bytes_type" class String(Type): + """String SQL type.""" expected_type = str value_pb_dict_field_name = "string_value" type_field_name = "string_type" class Int64(Type): + """Int64 SQL type.""" expected_type = int value_pb_dict_field_name = "int_value" type_field_name = "int64_type" class Float64(Type): + """Float64 SQL type.""" expected_type = float value_pb_dict_field_name = "float_value" type_field_name = "float64_type" class Bool(Type): + """Bool SQL type.""" expected_type = bool value_pb_dict_field_name = "bool_value" type_field_name = "bool_type" class Timestamp(Type): """ + Timestamp SQL type. + Timestamp supports :class:`DatetimeWithNanoseconds` but Bigtable SQL does not currently support nanoseconds precision. We support this for potential compatibility in the future. Nanoseconds are currently ignored. @@ -243,6 +253,7 @@ def _to_value_pb_dict(self, value: Any) -> Dict[str, Any]: return {"timestamp_value": ts} class Date(Type): + """Date SQL type.""" type_field_name = "date_type" expected_type = datetime.date @@ -265,10 +276,21 @@ def _to_value_pb_dict(self, value: Any) -> Dict[str, Any]: class Metadata: + """ + Base class for metadata returned by the ExecuteQuery operation. + """ pass class ProtoMetadata(Metadata): + """ + Metadata class for the ExecuteQuery operation. + + Args: + columns (List[Tuple[Optional[str], SqlType.Type]]): List of column + metadata tuples. Each tuple contains the column name and the column + type. + """ class Column: def __init__(self, column_name: Optional[str], column_type: SqlType.Type): self._column_name = column_name From 94c77aa17def67fcd7ef86da7451dcdc8de4cb1b Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 8 Aug 2024 17:18:04 -0700 Subject: [PATCH 10/22] fix nox reference --- .kokoro/publish-docs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.kokoro/publish-docs.sh b/.kokoro/publish-docs.sh index 233205d58..6f9c499ed 100755 --- a/.kokoro/publish-docs.sh +++ b/.kokoro/publish-docs.sh @@ -25,7 +25,7 @@ python3.10 -m pip install --require-hashes -r .kokoro/requirements.txt python3.10 -m nox --version # build docs -nox -s docs +python3.10 nox -s docs # create metadata python3.10 -m docuploader create-metadata \ @@ -44,7 +44,7 @@ python3.10 -m docuploader upload docs/_build/html --metadata-file docs.metadata # docfx yaml files -nox -s docfx +python3.10 nox -s docfx # create metadata. python3.10 -m docuploader create-metadata \ From 01029565db2693ace738bf827feaf900b2129984 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 8 Aug 2024 17:20:52 -0700 Subject: [PATCH 11/22] ran blacken --- .../execute_query/_async/execute_query_iterator.py | 3 ++- google/cloud/bigtable/data/execute_query/metadata.py | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py b/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py index 633850a3a..e0ba12d0e 100644 --- a/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py +++ b/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py @@ -23,7 +23,7 @@ Optional, Sequence, Tuple, - TYPE_CHECKING + TYPE_CHECKING, ) from google.api_core import retry as retries @@ -47,6 +47,7 @@ if TYPE_CHECKING: from google.cloud.bigtable.data import BigtableDataClientAsync + class ExecuteQueryIteratorAsync: """ ExecuteQueryIteratorAsync handles collecting streaming responses from the diff --git a/google/cloud/bigtable/data/execute_query/metadata.py b/google/cloud/bigtable/data/execute_query/metadata.py index 531446cab..0c9cf9697 100644 --- a/google/cloud/bigtable/data/execute_query/metadata.py +++ b/google/cloud/bigtable/data/execute_query/metadata.py @@ -91,6 +91,7 @@ def __repr__(self) -> str: class Struct(_NamedList[Type], Type): """Struct SQL type.""" + @classmethod def from_pb_type(cls, type_pb: Optional[PBType] = None) -> "SqlType.Struct": if type_pb is None: @@ -122,6 +123,7 @@ def __str__(self): class Array(Type): """Array SQL type.""" + def __init__(self, element_type: "SqlType.Type"): if isinstance(element_type, SqlType.Array): raise ValueError("Arrays of arrays are not supported.") @@ -151,6 +153,7 @@ def __str__(self) -> str: class Map(Type): """Map SQL type.""" + def __init__(self, key_type: "SqlType.Type", value_type: "SqlType.Type"): self._key_type = key_type self._value_type = value_type @@ -193,30 +196,35 @@ def __str__(self) -> str: class Bytes(Type): """Bytes SQL type.""" + expected_type = bytes value_pb_dict_field_name = "bytes_value" type_field_name = "bytes_type" class String(Type): """String SQL type.""" + expected_type = str value_pb_dict_field_name = "string_value" type_field_name = "string_type" class Int64(Type): """Int64 SQL type.""" + expected_type = int value_pb_dict_field_name = "int_value" type_field_name = "int64_type" class Float64(Type): """Float64 SQL type.""" + expected_type = float value_pb_dict_field_name = "float_value" type_field_name = "float64_type" class Bool(Type): """Bool SQL type.""" + expected_type = bool value_pb_dict_field_name = "bool_value" type_field_name = "bool_type" @@ -254,6 +262,7 @@ def _to_value_pb_dict(self, value: Any) -> Dict[str, Any]: class Date(Type): """Date SQL type.""" + type_field_name = "date_type" expected_type = datetime.date @@ -279,6 +288,7 @@ class Metadata: """ Base class for metadata returned by the ExecuteQuery operation. """ + pass @@ -291,6 +301,7 @@ class ProtoMetadata(Metadata): metadata tuples. Each tuple contains the column name and the column type. """ + class Column: def __init__(self, column_name: Optional[str], column_type: SqlType.Type): self._column_name = column_name From bdeeb6b2cd8db325025834469865f89526b7fc96 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 8 Aug 2024 17:24:31 -0700 Subject: [PATCH 12/22] fixed client docstring --- google/cloud/bigtable/data/_async/client.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/google/cloud/bigtable/data/_async/client.py b/google/cloud/bigtable/data/_async/client.py index d5ae514ab..82a874918 100644 --- a/google/cloud/bigtable/data/_async/client.py +++ b/google/cloud/bigtable/data/_async/client.py @@ -482,6 +482,8 @@ async def execute_query( retryable_errors: a list of errors that will be retried if encountered. Defaults to 4 (DeadlineExceeded), 14 (ServiceUnavailable), and 10 (Aborted) Returns: + ExecuteQueryIteratorAsync: an asynchronous iterator that yields rows returned by the query + Raises: google.api_core.exceptions.DeadlineExceeded: raised after operation timeout will be chained with a RetryExceptionGroup containing GoogleAPIError exceptions from any retries that failed From 0dbc1339fb1e98b236a5ff0c340f6cda59a65365 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 8 Aug 2024 17:27:14 -0700 Subject: [PATCH 13/22] changed nox location --- .kokoro/build.sh | 4 ++-- .kokoro/publish-docs.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index b00036db3..10a68571c 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -46,7 +46,7 @@ fi # If NOX_SESSION is set, it only runs the specified session, # otherwise run all the sessions. if [[ -n "${NOX_SESSION:-}" ]]; then - python3 -m nox -s ${NOX_SESSION:-} + python3.10 -m nox -s ${NOX_SESSION:-} else - python3 -m nox + python3.10 -m nox fi diff --git a/.kokoro/publish-docs.sh b/.kokoro/publish-docs.sh index 6f9c499ed..233205d58 100755 --- a/.kokoro/publish-docs.sh +++ b/.kokoro/publish-docs.sh @@ -25,7 +25,7 @@ python3.10 -m pip install --require-hashes -r .kokoro/requirements.txt python3.10 -m nox --version # build docs -python3.10 nox -s docs +nox -s docs # create metadata python3.10 -m docuploader create-metadata \ @@ -44,7 +44,7 @@ python3.10 -m docuploader upload docs/_build/html --metadata-file docs.metadata # docfx yaml files -python3.10 nox -s docfx +nox -s docfx # create metadata. python3.10 -m docuploader create-metadata \ From a10d3e5b7b9158106893b45e7a52541bc1b3e42a Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 8 Aug 2024 17:43:10 -0700 Subject: [PATCH 14/22] updated python version --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 5fb94526d..b3acb3bfb 100644 --- a/noxfile.py +++ b/noxfile.py @@ -357,7 +357,7 @@ def cover(session): session.run("coverage", "erase") -@nox.session(python="3.9") +@nox.session(python="3.10") def docs(session): """Build the docs for this library.""" From 6e8c296af1cad5f13e5bc603a826890834ac161a Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Thu, 8 Aug 2024 17:44:08 -0700 Subject: [PATCH 15/22] reverted build file changes --- .kokoro/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 10a68571c..b00036db3 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -46,7 +46,7 @@ fi # If NOX_SESSION is set, it only runs the specified session, # otherwise run all the sessions. if [[ -n "${NOX_SESSION:-}" ]]; then - python3.10 -m nox -s ${NOX_SESSION:-} + python3 -m nox -s ${NOX_SESSION:-} else - python3.10 -m nox + python3 -m nox fi From 25783883d76cccbd2ca2942dc49ab2e8bbf063dd Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Fri, 9 Aug 2024 10:51:50 -0700 Subject: [PATCH 16/22] Update Dockerfile --- .kokoro/docker/docs/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index e5410e296..62c13caee 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -74,6 +74,10 @@ RUN make altinstall ENV PATH /usr/local/bin/python3.10:$PATH +# Update the python3 symlink +RUN rm /usr/bin/python3 && \ + ln -s /usr/bin/python3.10 /usr/bin/python3 + ###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ && python3.10 /tmp/get-pip.py \ From 957f93c903d2098e0f594260390f8597a9e5d87c Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Fri, 9 Aug 2024 11:35:01 -0700 Subject: [PATCH 17/22] Update Dockerfile --- .kokoro/docker/docs/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 62c13caee..d6e7fc0a2 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -76,7 +76,7 @@ ENV PATH /usr/local/bin/python3.10:$PATH # Update the python3 symlink RUN rm /usr/bin/python3 && \ - ln -s /usr/bin/python3.10 /usr/bin/python3 + ln -s /usr/local/bin/python3.10 /usr/bin/python3 ###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ From 5e5d1de5782f8190de1a93bd4d8b481411242823 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Fri, 9 Aug 2024 12:43:17 -0700 Subject: [PATCH 18/22] added docstrigns for public values --- google/cloud/bigtable/data/execute_query/values.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/google/cloud/bigtable/data/execute_query/values.py b/google/cloud/bigtable/data/execute_query/values.py index 394bef71e..29840edd2 100644 --- a/google/cloud/bigtable/data/execute_query/values.py +++ b/google/cloud/bigtable/data/execute_query/values.py @@ -112,8 +112,14 @@ def __repr__(self) -> str: class QueryResultRow(_NamedList[ExecuteQueryValueType]): + """ + Represents a single row of the result + """ pass class Struct(_NamedList[ExecuteQueryValueType]): + """ + Represents a struct value in the result + """ pass From d592fc9b50f13845013bc61d46416b41456f06b2 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Fri, 9 Aug 2024 13:05:20 -0700 Subject: [PATCH 19/22] removed duplicated types from docstrings --- .../_async/execute_query_iterator.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py b/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py index e0ba12d0e..32081939b 100644 --- a/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py +++ b/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py @@ -59,18 +59,18 @@ class ExecuteQueryIteratorAsync: It is **not thread-safe**. It should not be used by multiple asyncio Tasks. Args: - client (google.cloud.bigtable.data.BigtableDataClientAsync): bigtable client - instance_id (str): id of the instance on which the query is executed - request_body (Dict[str, Any]): dict representing the body of the ExecuteQueryRequest - attempt_timeout (float | None): the time budget for the entire operation, in seconds. + client: bigtable client + instance_id: id of the instance on which the query is executed + request_body: dict representing the body of the ExecuteQueryRequest + attempt_timeout: the time budget for the entire operation, in seconds. Failed requests will be retried within the budget. Defaults to 600 seconds. - operation_timeout (float): the time budget for an individual network request, in seconds. + operation_timeout: the time budget for an individual network request, in seconds. If it takes longer than this time to complete, the request will be cancelled with a DeadlineExceeded exception, and a retry will be attempted. Defaults to the 20 seconds. If None, defaults to operation_timeout. - req_metadata (Sequence[Tuple[str, str]]): metadata used while sending the gRPC request - retryable_excs (List[type[Exception]]): a list of errors that will be retried if encountered. + req_metadata: metadata used while sending the gRPC request + retryable_excs: a list of errors that will be retried if encountered. Raises: RuntimeError: if the instance is not created within an async event loop context. """ @@ -185,7 +185,7 @@ async def _next_impl(self) -> AsyncIterator[QueryResultRow]: yield result await self.close() - async def __anext__(self): + async def __anext__(self) -> QueryResultRow: if self._is_closed: raise StopAsyncIteration return await self._result_generator.__anext__() From 47f3cfedb0abb353b99a053b624acd0e3bd4ff9e Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Fri, 9 Aug 2024 13:19:15 -0700 Subject: [PATCH 20/22] fixed lint --- google/cloud/bigtable/data/execute_query/values.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/google/cloud/bigtable/data/execute_query/values.py b/google/cloud/bigtable/data/execute_query/values.py index 29840edd2..80a0bff6f 100644 --- a/google/cloud/bigtable/data/execute_query/values.py +++ b/google/cloud/bigtable/data/execute_query/values.py @@ -115,11 +115,9 @@ class QueryResultRow(_NamedList[ExecuteQueryValueType]): """ Represents a single row of the result """ - pass class Struct(_NamedList[ExecuteQueryValueType]): """ Represents a struct value in the result """ - pass From fc6f295169fe4ad65e622d2fbbde79f8ad1483e5 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 9 Aug 2024 20:21:41 +0000 Subject: [PATCH 21/22] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20?= =?UTF-8?q?post-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .kokoro/docker/docs/Dockerfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index d6e7fc0a2..e5410e296 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -74,10 +74,6 @@ RUN make altinstall ENV PATH /usr/local/bin/python3.10:$PATH -# Update the python3 symlink -RUN rm /usr/bin/python3 && \ - ln -s /usr/local/bin/python3.10 /usr/bin/python3 - ###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ && python3.10 /tmp/get-pip.py \ From 9b0220bb9f4047b86ec352ce2feebd6811ed31c7 Mon Sep 17 00:00:00 2001 From: Daniel Sanche Date: Fri, 9 Aug 2024 13:54:37 -0700 Subject: [PATCH 22/22] revert noxfile --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index b3acb3bfb..5fb94526d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -357,7 +357,7 @@ def cover(session): session.run("coverage", "erase") -@nox.session(python="3.10") +@nox.session(python="3.9") def docs(session): """Build the docs for this library."""