Method: googleapis.spanner.v1.projects.instances.databases.sessions.partitionQuery

Creates a set of partition tokens that can be used to execute a query operation in parallel. Each of the returned partition tokens can be used by ExecuteStreamingSql to specify a subset of the query result to read. The same session and read-only transaction must be used by the PartitionQueryRequest used to create the partition tokens and the ExecuteSqlRequests that use the partition tokens. 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 query, and the whole operation must be restarted from the beginning.

Arguments

Parameters
session

string

Required. The session used to create the partitions.

body

object (PartitionQueryRequest)

Required.

Raised exceptions

Exceptions
ConnectionError In case of a network problem (such as DNS failure or refused connection).
HttpError If the response status is >= 400 (excluding 429 and 503).
TimeoutError If a long-running operation takes longer to finish than the specified timeout limit.
TypeError If an operation or function receives an argument of the wrong type.
ValueError If an operation or function receives an argument of the right type but an inappropriate value. For example, a negative timeout.

Response

If successful, the response contains an instance of PartitionResponse.

Subworkflow snippet

Some fields might be optional or required. To identify required fields, refer to the API documentation.

YAML

- partitionQuery:
    call: googleapis.spanner.v1.projects.instances.databases.sessions.partitionQuery
    args:
        session: ...
        body:
            paramTypes: ...
            params: ...
            partitionOptions:
                maxPartitions: ...
                partitionSizeBytes: ...
            sql: ...
            transaction:
                begin:
                    partitionedDml: ...
                    readOnly:
                        exactStaleness: ...
                        maxStaleness: ...
                        minReadTimestamp: ...
                        readTimestamp: ...
                        returnReadTimestamp: ...
                        strong: ...
                    readWrite:
                        readLockMode: ...
                id: ...
                singleUse: ...
    result: partitionQueryResult

JSON

[
  {
    "partitionQuery": {
      "call": "googleapis.spanner.v1.projects.instances.databases.sessions.partitionQuery",
      "args": {
        "session": "...",
        "body": {
          "paramTypes": "...",
          "params": "...",
          "partitionOptions": {
            "maxPartitions": "...",
            "partitionSizeBytes": "..."
          },
          "sql": "...",
          "transaction": {
            "begin": {
              "partitionedDml": "...",
              "readOnly": {
                "exactStaleness": "...",
                "maxStaleness": "...",
                "minReadTimestamp": "...",
                "readTimestamp": "...",
                "returnReadTimestamp": "...",
                "strong": "..."
              },
              "readWrite": {
                "readLockMode": "..."
              }
            },
            "id": "...",
            "singleUse": "..."
          }
        }
      },
      "result": "partitionQueryResult"
    }
  }
]