Package types (3.56.0)

API documentation for spanner_v1.types package.

Classes

BatchCreateSessionsRequest

The request for BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].

BatchCreateSessionsResponse

The response for BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].

BatchWriteRequest

The request for BatchWrite][google.spanner.v1.Spanner.BatchWrite].

BatchWriteResponse

The result of applying a batch of mutations.

BeginTransactionRequest

The request for BeginTransaction][google.spanner.v1.Spanner.BeginTransaction].

ChangeStreamRecord

Spanner Change Streams enable customers to capture and stream out changes to their Spanner databases in real-time. A change stream can be created with option partition_mode='IMMUTABLE_KEY_RANGE' or partition_mode='MUTABLE_KEY_RANGE'.

This message is only used in Change Streams created with the option partition_mode='MUTABLE_KEY_RANGE'. Spanner automatically creates a special Table-Valued Function (TVF) along with each Change Streams. The function provides access to the change stream's records. The function is named READ_<change_stream_name> (where <change_stream_name> is the name of the change stream), and it returns a table with only one column called ChangeRecord.

This message has oneof_ fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

CommitRequest

The request for Commit][google.spanner.v1.Spanner.Commit].

This message has oneof_ fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

CommitResponse

The response for Commit][google.spanner.v1.Spanner.Commit].

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

CreateSessionRequest

The request for CreateSession][google.spanner.v1.Spanner.CreateSession].

DeleteSessionRequest

The request for DeleteSession][google.spanner.v1.Spanner.DeleteSession].

DirectedReadOptions

The DirectedReadOptions can be used to indicate which replicas or regions should be used for non-transactional reads or queries.

DirectedReadOptions may only be specified for a read-only transaction, otherwise the API will return an INVALID_ARGUMENT error.

This message has oneof_ fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

ExecuteBatchDmlRequest

The request for ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml].

ExecuteBatchDmlResponse

The response for ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list of ResultSet][google.spanner.v1.ResultSet] messages, one for each DML statement that has successfully executed, in the same order as the statements in the request. If a statement fails, the status in the response body identifies the cause of the failure.

To check for DML statements that failed, use the following approach:

  1. Check the status in the response message. The google.rpc.Code][google.rpc.Code] enum value OK indicates that all statements were executed successfully.
  2. If the status was not OK, check the number of result sets in the response. If the response contains N ResultSet][google.spanner.v1.ResultSet] messages, then statement N+1 in the request failed.

Example 1:

  • Request: 5 DML statements, all executed successfully.
  • Response: 5 ResultSet][google.spanner.v1.ResultSet] messages, with the status OK.

Example 2:

  • Request: 5 DML statements. The third statement has a syntax error.
  • Response: 2 ResultSet][google.spanner.v1.ResultSet] messages, and a syntax error (INVALID_ARGUMENT) status. The number of ResultSet][google.spanner.v1.ResultSet] messages indicates that the third statement failed, and the fourth and fifth statements were not executed.

ExecuteSqlRequest

The request for ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql].

GetSessionRequest

The request for GetSession][google.spanner.v1.Spanner.GetSession].

KeyRange

KeyRange represents a range of rows in a table or index.

A range has a start key and an end key. These keys can be open or closed, indicating if the range includes rows with that key.

Keys are represented by lists, where the ith value in the list corresponds to the ith component of the table or index primary key. Individual values are encoded as described here][google.spanner.v1.TypeCode].

For example, consider the following table definition:

::

CREATE TABLE UserEvents (
  UserName STRING(MAX),
  EventDate STRING(10)
) PRIMARY KEY(UserName, EventDate);

The following keys name rows in this table:

::

["Bob", "2014-09-23"]
["Alfred", "2015-06-12"]

Since the UserEvents table's PRIMARY KEY clause names two columns, each UserEvents key has two elements; the first is the UserName, and the second is the EventDate.

Key ranges with multiple components are interpreted lexicographically by component using the table or index key's declared sort order. For example, the following range returns all events for user "Bob" that occurred in the year 2015:

::

"start_closed": ["Bob", "2015-01-01"]
"end_closed": ["Bob", "2015-12-31"]

Start and end keys can omit trailing key components. This affects the inclusion and exclusion of rows that exactly match the provided key components: if the key is closed, then rows that exactly match the provided components are included; if the key is open, then rows that exactly match are not included.

For example, the following range includes all events for "Bob" that occurred during and after the year 2000:

::

"start_closed": ["Bob", "2000-01-01"]
"end_closed": ["Bob"]

The next example retrieves all events for "Bob":

::

"start_closed": ["Bob"]
"end_closed": ["Bob"]

To retrieve events before the year 2000:

::

"start_closed": ["Bob"]
"end_open": ["Bob", "2000-01-01"]

The following range includes all rows in the table:

::

"start_closed": []
"end_closed": []

This range returns all users whose UserName begins with any character from A to C:

::

"start_closed": ["A"]
"end_open": ["D"]

This range returns all users whose UserName begins with B:

::

"start_closed": ["B"]
"end_open": ["C"]

Key ranges honor column sort order. For example, suppose a table is defined as follows:

::

CREATE TABLE DescendingSortedTable {
  Key INT64,
  ...
) PRIMARY KEY(Key DESC);

The following range retrieves all rows with key values between 1 and 100 inclusive:

::

"start_closed": ["100"]
"end_closed": ["1"]

Note that 100 is passed as the start, and 1 is passed as the end, because Key is a descending column in the schema.

This message has oneof_ fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

KeySet

KeySet defines a collection of Cloud Spanner keys and/or key ranges. All the keys are expected to be in the same table or index. The keys need not be sorted in any particular way.

If the same key is specified multiple times in the set (for example if two ranges, two keys, or a key and a range overlap), Cloud Spanner behaves as if the key were only specified once.

ListSessionsRequest

The request for ListSessions][google.spanner.v1.Spanner.ListSessions].

ListSessionsResponse

The response for ListSessions][google.spanner.v1.Spanner.ListSessions].

MultiplexedSessionPrecommitToken

When a read-write transaction is executed on a multiplexed session, this precommit token is sent back to the client as a part of the Transaction][google.spanner.v1.Transaction] message in the BeginTransaction][google.spanner.v1.BeginTransactionRequest] response and also as a part of the ResultSet][google.spanner.v1.ResultSet] and PartialResultSet][google.spanner.v1.PartialResultSet] responses.

Mutation

A modification to one or more Cloud Spanner rows. Mutations can be applied to a Cloud Spanner database by sending them in a Commit][google.spanner.v1.Spanner.Commit] call.

This message has oneof_ fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

PartialResultSet

Partial results from a streaming read or SQL query. Streaming reads and SQL queries better tolerate large result sets, large rows, and large values, but are a little trickier to consume.

Partition

Information returned for each partition returned in a PartitionResponse.

PartitionOptions

Options for a PartitionQueryRequest and PartitionReadRequest.

PartitionQueryRequest

The request for PartitionQuery][google.spanner.v1.Spanner.PartitionQuery]

PartitionReadRequest

The request for PartitionRead][google.spanner.v1.Spanner.PartitionRead]

PartitionResponse

The response for PartitionQuery][google.spanner.v1.Spanner.PartitionQuery] or PartitionRead][google.spanner.v1.Spanner.PartitionRead]

PlanNode

Node information for nodes appearing in a QueryPlan.plan_nodes][google.spanner.v1.QueryPlan.plan_nodes].

QueryPlan

Contains an ordered list of nodes appearing in the query plan.

ReadRequest

The request for Read][google.spanner.v1.Spanner.Read] and StreamingRead][google.spanner.v1.Spanner.StreamingRead].

RequestOptions

Common request options for various APIs.

ResultSet

Results from Read][google.spanner.v1.Spanner.Read] or ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].

ResultSetMetadata

Metadata about a ResultSet][google.spanner.v1.ResultSet] or PartialResultSet][google.spanner.v1.PartialResultSet].

ResultSetStats

Additional statistics about a ResultSet][google.spanner.v1.ResultSet] or PartialResultSet][google.spanner.v1.PartialResultSet].

This message has oneof_ fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

RollbackRequest

The request for Rollback][google.spanner.v1.Spanner.Rollback].

Session

A session in the Cloud Spanner API.

StructType

StructType defines the fields of a STRUCT][google.spanner.v1.TypeCode.STRUCT] type.

Transaction

A transaction.

TransactionOptions

Options to use for transactions.

This message has oneof_ fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

TransactionSelector

This message is used to select the transaction in which a Read][google.spanner.v1.Spanner.Read] or ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] call runs.

See TransactionOptions][google.spanner.v1.TransactionOptions] for more information about transactions.

This message has oneof_ fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

Type

Type indicates the type of a Cloud Spanner value, as might be stored in a table cell or returned from an SQL query.

TypeAnnotationCode

TypeAnnotationCode is used as a part of Type][google.spanner.v1.Type] to disambiguate SQL types that should be used for a given Cloud Spanner value. Disambiguation is needed because the same Cloud Spanner type can be mapped to different SQL types depending on SQL dialect. TypeAnnotationCode doesn't affect the way value is serialized.

TypeCode

TypeCode is used as part of Type][google.spanner.v1.Type] to indicate the type of a Cloud Spanner value.

Each legal value of a type can be encoded to or decoded from a JSON value, using the encodings described below. All Cloud Spanner values can be null, regardless of type; null\ s are always encoded as a JSON null.

    If the schema has the column option
    `allow_commit_timestamp=true`, the placeholder string
    `"spanner.commit_timestamp()"` can be used to instruct the
    system to insert the commit timestamp associated with the
    transaction commit.
DATE (5):
    Encoded as `string` in RFC 3339 date format.
STRING (6):
    Encoded as `string`.
BYTES (7):
    Encoded as a base64-encoded `string`, as described in RFC
    4648, section 4.
ARRAY (8):
    Encoded as `list`, where the list elements are represented
    according to
    `array_element_type][google.spanner.v1.Type.array_element_type]`.
STRUCT (9):
    Encoded as `list`, where list element `i` is represented
    according to
    [struct_type.fields[i]][google.spanner.v1.StructType.fields].
NUMERIC (10):
    Encoded as `string`, in decimal format or scientific
    notation format. Decimal format: `[+-]Digits[.[Digits]]`
    or `[+-][Digits].Digits`

    Scientific notation:
    `[+-]Digits[.[Digits]][ExponentIndicator[+-]Digits]` or
    `[+-][Digits].Digits[ExponentIndicator[+-]Digits]`
    (ExponentIndicator is `"e"` or `"E"`)
JSON (11):
    Encoded as a JSON-formatted `string` as described in RFC
    7159. The following rules are applied when parsing JSON
    input:

    -  Whitespace characters are not preserved.
    -  If a JSON object has duplicate keys, only the first key
       is preserved.
    -  Members of a JSON object are not guaranteed to have their
       order preserved.
    -  JSON array elements will have their order preserved.
PROTO (13):
    Encoded as a base64-encoded `string`, as described in RFC
    4648, section 4.
ENUM (14):
    Encoded as `string`, in decimal format.
INTERVAL (16):
    Encoded as `string`, in `ISO8601` duration format -
    `P[n]Y[n]M[n]DT[n]H[n]M[n[.fraction]]S` where `n` is an
    integer. For example, `P1Y2M3DT4H5M6.5S` represents time
    duration of 1 year, 2 months, 3 days, 4 hours, 5 minutes,
    and 6.5 seconds.
UUID (17):
    Encoded as `string`, in lower-case hexa-decimal format, as
    described in RFC 9562, section 4.