Class DirectedReadOptions (3.46.0)

DirectedReadOptions(mapping=None, *, ignore_unknown_fields=False, **kwargs)

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

Attributes

Name Description
include_replicas google.cloud.spanner_v1.types.DirectedReadOptions.IncludeReplicas
Include_replicas indicates the order of replicas (as they appear in this list) to process the request. If auto_failover_disabled is set to true and all replicas are exhausted without finding a healthy replica, Spanner will wait for a replica in the list to become available, requests may fail due to DEADLINE_EXCEEDED errors. This field is a member of oneof_ replicas.
exclude_replicas google.cloud.spanner_v1.types.DirectedReadOptions.ExcludeReplicas
Exclude_replicas indicates that specified replicas should be excluded from serving requests. Spanner will not route requests to the replicas in this list. This field is a member of oneof_ replicas.

Classes

ExcludeReplicas

ExcludeReplicas(mapping=None, *, ignore_unknown_fields=False, **kwargs)

An ExcludeReplicas contains a repeated set of ReplicaSelection that should be excluded from serving requests.

IncludeReplicas

IncludeReplicas(mapping=None, *, ignore_unknown_fields=False, **kwargs)

An IncludeReplicas contains a repeated set of ReplicaSelection which indicates the order in which replicas should be considered.

ReplicaSelection

ReplicaSelection(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The directed read replica selector. Callers must provide one or more of the following fields for replica selection:

  • location - The location must be one of the regions within the multi-region configuration of your database.
  • type - The type of the replica.

Some examples of using replica_selectors are:

  • location:us-east1 --> The "us-east1" replica(s) of any available type will be used to process the request.
  • type:READ_ONLY --> The "READ_ONLY" type replica(s) in nearest available location will be used to process the request.
  • location:us-east1 type:READ_ONLY --> The "READ_ONLY" type replica(s) in location "us-east1" will be used to process the request.