nodes: 0, module; 1, function_definition; 2, function_name:partition_read; 3, parameters; 4, block; 5, identifier:self; 6, identifier:session; 7, identifier:table; 8, identifier:key_set; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, default_parameter; 16, expression_statement; 17, comment:# Wrap the transport method to add retry and timeout logic.; 18, if_statement; 19, expression_statement; 20, if_statement; 21, expression_statement; 22, try_statement; 23, return_statement; 24, identifier:transaction; 25, None; 26, identifier:index; 27, None; 28, identifier:columns; 29, None; 30, identifier:partition_options; 31, None; 32, identifier:retry; 33, attribute; 34, identifier:timeout; 35, attribute; 36, identifier:metadata; 37, None; 38, comment:"""
          Creates a set of partition tokens that can be used to execute a read
          operation in parallel. Each of the returned partition tokens can be used
          by ``StreamingRead`` to specify a subset of the read result to read. The
          same session and read-only transaction must be used by the
          PartitionReadRequest used to create the partition tokens and the
          ReadRequests that use the partition tokens. There are no ordering
          guarantees on rows returned among the returned partition tokens, or even
          within each individual StreamingRead call issued with a
          partition\_token.
  
          Partition tokens become invalid when the session used to create them is
          deleted, is idle for too long, begins a new transaction, or becomes too
          old. When any of these happen, it is not possible to resume the read,
          and the whole operation must be restarted from the beginning.
  
          Example:
              >>> from google.cloud import spanner_v1
              >>>
              >>> client = spanner_v1.SpannerClient()
              >>>
              >>> session = client.session_path('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]')
              >>>
              >>> # TODO: Initialize `table`:
              >>> table = ''
              >>>
              >>> # TODO: Initialize `key_set`:
              >>> key_set = {}
              >>>
              >>> response = client.partition_read(session, table, key_set)
  
          Args:
              session (str): Required. The session used to create the partitions.
              table (str): Required. The name of the table in the database to be read.
              key_set (Union[dict, ~google.cloud.spanner_v1.types.KeySet]): Required. ``key_set`` identifies the rows to be yielded. ``key_set``
                  names the primary keys of the rows in ``table`` to be yielded, unless
                  ``index`` is present. If ``index`` is present, then ``key_set`` instead
                  names index keys in ``index``.
  
                  It is not an error for the ``key_set`` to name rows that do not exist in
                  the database. Read yields nothing for nonexistent rows.
  
                  If a dict is provided, it must be of the same form as the protobuf
                  message :class:`~google.cloud.spanner_v1.types.KeySet`
              transaction (Union[dict, ~google.cloud.spanner_v1.types.TransactionSelector]): Read only snapshot transactions are supported, read/write and single use
                  transactions are not.
  
                  If a dict is provided, it must be of the same form as the protobuf
                  message :class:`~google.cloud.spanner_v1.types.TransactionSelector`
              index (str): If non-empty, the name of an index on ``table``. This index is used
                  instead of the table primary key when interpreting ``key_set`` and
                  sorting result rows. See ``key_set`` for further information.
              columns (list[str]): The columns of ``table`` to be returned for each row matching this
                  request.
              partition_options (Union[dict, ~google.cloud.spanner_v1.types.PartitionOptions]): Additional options that affect how many partitions are created.
  
                  If a dict is provided, it must be of the same form as the protobuf
                  message :class:`~google.cloud.spanner_v1.types.PartitionOptions`
              retry (Optional[google.api_core.retry.Retry]):  A retry object used
                  to retry requests. If ``None`` is specified, requests will not
                  be retried.
              timeout (Optional[float]): The amount of time, in seconds, to wait
                  for the request to complete. Note that if ``retry`` is
                  specified, the timeout applies to each individual attempt.
              metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
                  that is provided to the method.
  
          Returns:
              A :class:`~google.cloud.spanner_v1.types.PartitionResponse` instance.
  
          Raises:
              google.api_core.exceptions.GoogleAPICallError: If the request
                      failed for any reason.
              google.api_core.exceptions.RetryError: If the request failed due
                      to a retryable error and retry attempts failed.
              ValueError: If the parameters are invalid.
          """; 39, comparison_operator:"partition_read" not in self._inner_api_calls; 40, block; 41, assignment; 42, comparison_operator:metadata is None; 43, block; 44, assignment; 45, block; 46, except_clause; 47, else_clause; 48, call; 49, attribute; 50, identifier:DEFAULT; 51, attribute; 52, identifier:DEFAULT; 53, string:"partition_read"; 54, attribute; 55, expression_statement; 56, identifier:request; 57, call; 58, identifier:metadata; 59, None; 60, expression_statement; 61, identifier:metadata; 62, call; 63, expression_statement; 64, identifier:AttributeError; 65, block; 66, block; 67, subscript; 68, argument_list; 69, attribute; 70, identifier:method; 71, attribute; 72, identifier:method; 73, identifier:self; 74, identifier:_inner_api_calls; 75, assignment; 76, attribute; 77, argument_list; 78, assignment; 79, identifier:list; 80, argument_list; 81, assignment; 82, pass_statement; 83, expression_statement; 84, expression_statement; 85, attribute; 86, string:"partition_read"; 87, identifier:request; 88, keyword_argument; 89, keyword_argument; 90, keyword_argument; 91, attribute; 92, identifier:gapic_v1; 93, attribute; 94, identifier:gapic_v1; 95, subscript; 96, call; 97, identifier:spanner_pb2; 98, identifier:PartitionReadRequest; 99, keyword_argument; 100, keyword_argument; 101, keyword_argument; 102, keyword_argument; 103, keyword_argument; 104, keyword_argument; 105, keyword_argument; 106, identifier:metadata; 107, list; 108, identifier:metadata; 109, identifier:routing_header; 110, list; 111, assignment; 112, call; 113, identifier:self; 114, identifier:_inner_api_calls; 115, identifier:retry; 116, identifier:retry; 117, identifier:timeout; 118, identifier:timeout; 119, identifier:metadata; 120, identifier:metadata; 121, identifier:google; 122, identifier:api_core; 123, identifier:google; 124, identifier:api_core; 125, attribute; 126, string:"partition_read"; 127, attribute; 128, argument_list; 129, identifier:session; 130, identifier:session; 131, identifier:table; 132, identifier:table; 133, identifier:key_set; 134, identifier:key_set; 135, identifier:transaction; 136, identifier:transaction; 137, identifier:index; 138, identifier:index; 139, identifier:columns; 140, identifier:columns; 141, identifier:partition_options; 142, identifier:partition_options; 143, tuple; 144, identifier:routing_metadata; 145, call; 146, attribute; 147, argument_list; 148, identifier:self; 149, identifier:_inner_api_calls; 150, attribute; 151, identifier:wrap_method; 152, attribute; 153, keyword_argument; 154, keyword_argument; 155, keyword_argument; 156, string:"session"; 157, identifier:session; 158, attribute; 159, argument_list; 160, identifier:metadata; 161, identifier:append; 162, identifier:routing_metadata; 163, attribute; 164, identifier:method; 165, attribute; 166, identifier:partition_read; 167, identifier:default_retry; 168, attribute; 169, identifier:default_timeout; 170, attribute; 171, identifier:client_info; 172, attribute; 173, attribute; 174, identifier:to_grpc_metadata; 175, identifier:routing_header; 176, attribute; 177, identifier:gapic_v1; 178, identifier:self; 179, identifier:transport; 180, subscript; 181, identifier:retry; 182, subscript; 183, identifier:timeout; 184, identifier:self; 185, identifier:_client_info; 186, attribute; 187, identifier:routing_header; 188, identifier:google; 189, identifier:api_core; 190, attribute; 191, string:"PartitionRead"; 192, attribute; 193, string:"PartitionRead"; 194, attribute; 195, identifier:gapic_v1; 196, identifier:self; 197, identifier:_method_configs; 198, identifier:self; 199, identifier:_method_configs; 200, identifier:google; 201, identifier:api_core
code: def partition_read(
          self,
          session,
          table,
          key_set,
          transaction=None,
          index=None,
          columns=None,
          partition_options=None,
          retry=google.api_core.gapic_v1.method.DEFAULT,
          timeout=google.api_core.gapic_v1.method.DEFAULT,
          metadata=None,
      ):
          """
          Creates a set of partition tokens that can be used to execute a read
          operation in parallel. Each of the returned partition tokens can be used
          by ``StreamingRead`` to specify a subset of the read result to read. The
          same session and read-only transaction must be used by the
          PartitionReadRequest used to create the partition tokens and the
          ReadRequests that use the partition tokens. There are no ordering
          guarantees on rows returned among the returned partition tokens, or even
          within each individual StreamingRead call issued with a
          partition\_token.
  
          Partition tokens become invalid when the session used to create them is
          deleted, is idle for too long, begins a new transaction, or becomes too
          old. When any of these happen, it is not possible to resume the read,
          and the whole operation must be restarted from the beginning.
  
          Example:
              >>> from google.cloud import spanner_v1
              >>>
              >>> client = spanner_v1.SpannerClient()
              >>>
              >>> session = client.session_path('[PROJECT]', '[INSTANCE]', '[DATABASE]', '[SESSION]')
              >>>
              >>> # TODO: Initialize `table`:
              >>> table = ''
              >>>
              >>> # TODO: Initialize `key_set`:
              >>> key_set = {}
              >>>
              >>> response = client.partition_read(session, table, key_set)
  
          Args:
              session (str): Required. The session used to create the partitions.
              table (str): Required. The name of the table in the database to be read.
              key_set (Union[dict, ~google.cloud.spanner_v1.types.KeySet]): Required. ``key_set`` identifies the rows to be yielded. ``key_set``
                  names the primary keys of the rows in ``table`` to be yielded, unless
                  ``index`` is present. If ``index`` is present, then ``key_set`` instead
                  names index keys in ``index``.
  
                  It is not an error for the ``key_set`` to name rows that do not exist in
                  the database. Read yields nothing for nonexistent rows.
  
                  If a dict is provided, it must be of the same form as the protobuf
                  message :class:`~google.cloud.spanner_v1.types.KeySet`
              transaction (Union[dict, ~google.cloud.spanner_v1.types.TransactionSelector]): Read only snapshot transactions are supported, read/write and single use
                  transactions are not.
  
                  If a dict is provided, it must be of the same form as the protobuf
                  message :class:`~google.cloud.spanner_v1.types.TransactionSelector`
              index (str): If non-empty, the name of an index on ``table``. This index is used
                  instead of the table primary key when interpreting ``key_set`` and
                  sorting result rows. See ``key_set`` for further information.
              columns (list[str]): The columns of ``table`` to be returned for each row matching this
                  request.
              partition_options (Union[dict, ~google.cloud.spanner_v1.types.PartitionOptions]): Additional options that affect how many partitions are created.
  
                  If a dict is provided, it must be of the same form as the protobuf
                  message :class:`~google.cloud.spanner_v1.types.PartitionOptions`
              retry (Optional[google.api_core.retry.Retry]):  A retry object used
                  to retry requests. If ``None`` is specified, requests will not
                  be retried.
              timeout (Optional[float]): The amount of time, in seconds, to wait
                  for the request to complete. Note that if ``retry`` is
                  specified, the timeout applies to each individual attempt.
              metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
                  that is provided to the method.
  
          Returns:
              A :class:`~google.cloud.spanner_v1.types.PartitionResponse` instance.
  
          Raises:
              google.api_core.exceptions.GoogleAPICallError: If the request
                      failed for any reason.
              google.api_core.exceptions.RetryError: If the request failed due
                      to a retryable error and retry attempts failed.
              ValueError: If the parameters are invalid.
          """
          # Wrap the transport method to add retry and timeout logic.
          if "partition_read" not in self._inner_api_calls:
              self._inner_api_calls[
                  "partition_read"
              ] = google.api_core.gapic_v1.method.wrap_method(
                  self.transport.partition_read,
                  default_retry=self._method_configs["PartitionRead"].retry,
                  default_timeout=self._method_configs["PartitionRead"].timeout,
                  client_info=self._client_info,
              )
  
          request = spanner_pb2.PartitionReadRequest(
              session=session,
              table=table,
              key_set=key_set,
              transaction=transaction,
              index=index,
              columns=columns,
              partition_options=partition_options,
          )
          if metadata is None:
              metadata = []
          metadata = list(metadata)
          try:
              routing_header = [("session", session)]
          except AttributeError:
              pass
          else:
              routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
                  routing_header
              )
              metadata.append(routing_metadata)
  
          return self._inner_api_calls["partition_read"](
              request, retry=retry, timeout=timeout, metadata=metadata
          )