Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Usage

import * as mod from "https://googleapis.deno.dev/v1/spanner:v1.ts";

§Classes

GoogleAuth
Spanner

Cloud Spanner is a managed, mission-critical, globally consistent and scalable relational database service.

§Variables

auth

§Interfaces

AutoscalingConfig

Autoscaling config for an instance.

AutoscalingLimits

The autoscaling limits for the instance. Users can define the minimum and maximum compute capacity allocated to the instance, and the autoscaler will only scale within that range. Users can either use nodes or processing units to specify the limits, but should use the same unit to set both the min_limit and max_limit.

AutoscalingTargets

The autoscaling targets for an instance.

Backup

A backup of a Cloud Spanner database.

BackupInfo

Information about a backup.

BatchCreateSessionsRequest

The request for BatchCreateSessions.

BatchCreateSessionsResponse

The response for BatchCreateSessions.

BatchWriteRequest

The request for BatchWrite.

BatchWriteResponse

The result of applying a batch of mutations.

BeginTransactionRequest

The request for BeginTransaction.

Binding

Associates members, or principals, with a role.

ChildLink

Metadata associated with a parent-child relationship appearing in a PlanNode.

CommitRequest

The request for Commit.

CommitResponse

The response for Commit.

CommitStats

Additional statistics about a commit.

ContextValue

A message representing context for a KeyRangeInfo, including a label, value, unit, and severity.

CopyBackupEncryptionConfig

Encryption configuration for the copied backup.

CopyBackupMetadata

Metadata type for the operation returned by CopyBackup.

CopyBackupRequest

The request for CopyBackup.

CreateBackupMetadata

Metadata type for the operation returned by CreateBackup.

CreateDatabaseMetadata

Metadata type for the operation returned by CreateDatabase.

CreateDatabaseRequest

The request for CreateDatabase.

CreateInstanceConfigMetadata

Metadata type for the operation returned by CreateInstanceConfig.

CreateInstanceConfigRequest

The request for CreateInstanceConfigRequest.

CreateInstanceMetadata

Metadata type for the operation returned by CreateInstance.

CreateInstancePartitionMetadata

Metadata type for the operation returned by CreateInstancePartition.

CreateInstancePartitionRequest

The request for CreateInstancePartition.

CreateInstanceRequest

The request for CreateInstance.

CreateSessionRequest

The request for CreateSession.

CredentialsClient

Defines the root interface for all clients that generate credentials for calling Google APIs. All clients should implement this interface.

Database

A Cloud Spanner database.

DatabaseRole

A Cloud Spanner database role.

DdlStatementActionInfo

Action information extracted from a DDL statement. This proto is used to display the brief info of the DDL statement for the operation UpdateDatabaseDdl.

Delete

Arguments to delete operations.

DerivedMetric

A message representing a derived metric.

DiagnosticMessage

A message representing the key visualizer diagnostic messages.

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.

Empty

A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }

EncryptionConfig

Encryption configuration for a Cloud Spanner database.

EncryptionInfo

Encryption information for a Cloud Spanner database or backup.

ExcludeReplicas

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

ExecuteBatchDmlRequest

The request for ExecuteBatchDml.

ExecuteBatchDmlResponse

The response for ExecuteBatchDml. Contains a list of 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 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 messages, then statement N+1 in the request failed. Example 1: * Request: 5 DML statements, all executed successfully. * Response: 5 ResultSet messages, with the status OK. Example 2: * Request: 5 DML statements. The third statement has a syntax error. * Response: 2 ResultSet messages, and a syntax error (INVALID_ARGUMENT) status. The number of ResultSet messages indicates that the third statement failed, and the fourth and fifth statements were not executed.

ExecuteSqlRequest

The request for ExecuteSql and ExecuteStreamingSql.

Expr

Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information.

Field

Message representing a single field of a struct.

FreeInstanceMetadata

Free instance specific metadata that is kept even after an instance has been upgraded for tracking purposes.

GetDatabaseDdlResponse

The response for GetDatabaseDdl.

GetIamPolicyRequest

Request message for GetIamPolicy method.

GetPolicyOptions

Encapsulates settings provided to GetIamPolicy.

IncludeReplicas

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

IndexAdvice

Recommendation to add new indexes to run queries more efficiently.

IndexedHotKey

A message representing a (sparse) collection of hot keys for specific key buckets.

IndexedKeyRangeInfos

A message representing a (sparse) collection of KeyRangeInfos for specific key buckets.

Instance

An isolated set of Cloud Spanner resources on which databases can be hosted.

InstanceConfig

A possible configuration for a Cloud Spanner instance. Configurations define the geographic placement of nodes and their replication.

InstanceOperationProgress

Encapsulates progress related information for a Cloud Spanner long running instance operations.

InstancePartition

An isolated set of Cloud Spanner resources that databases can define placements on.

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. 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" 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.

KeyRangeInfo

A message representing information for a key range (possibly one key).

KeyRangeInfos

A message representing a list of specific information for multiple key ranges.

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.

ListBackupOperationsResponse

The response for ListBackupOperations.

ListBackupsResponse

The response for ListBackups.

ListDatabaseOperationsResponse

The response for ListDatabaseOperations.

ListDatabaseRolesResponse

The response for ListDatabaseRoles.

ListDatabasesResponse

The response for ListDatabases.

ListInstanceConfigOperationsResponse

The response for ListInstanceConfigOperations.

ListInstanceConfigsResponse

The response for ListInstanceConfigs.

ListInstancePartitionOperationsResponse

The response for ListInstancePartitionOperations.

ListInstancePartitionsResponse

The response for ListInstancePartitions.

ListInstancesResponse

The response for ListInstances.

ListOperationsResponse

The response message for Operations.ListOperations.

ListScansResponse

Response method from the ListScans method.

ListSessionsResponse

The response for ListSessions.

LocalizedString

A message representing a user-facing string whose value may need to be translated before being displayed.

Metric

A message representing the actual monitoring data, values for each key bucket over time, of a metric.

MetricMatrix

A message representing a matrix of floats.

MetricMatrixRow

A message representing a row of a matrix of floats.

MoveInstanceRequest

The request for MoveInstance.

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 call.

MutationGroup

A group of mutations to be committed together. Related mutations should be placed in a group. For example, two mutations inserting rows with the same primary key prefix in both parent and child tables are related.

Operation

This resource represents a long-running operation that is the result of a network API call.

OperationProgress

Encapsulates progress related information for a Cloud Spanner long running operation.

OptimizeRestoredDatabaseMetadata

Metadata type for the long-running operation used to track the progress of optimizations performed on a newly restored database. This long-running operation is automatically created by the system after the successful completion of a database restore, and cannot be cancelled.

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.

PartitionedDml

Message type to initiate a Partitioned DML transaction.

PartitionOptions

Options for a PartitionQueryRequest and PartitionReadRequest.

PartitionQueryRequest

The request for PartitionQuery

PartitionReadRequest

The request for PartitionRead

PartitionResponse

The response for PartitionQuery or PartitionRead

PlanNode

Node information for nodes appearing in a QueryPlan.plan_nodes.

Policy

An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A Policy is a collection of bindings. A binding binds one or more members, or principals, to a single role. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A role is a named list of permissions; each role can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a binding can also specify a condition, which is a logical expression that allows access to a resource only if the expression evaluates to true. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the IAM documentation. JSON example: { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 } YAML example: ``` bindings: - members:

PrefixNode

A message representing a key prefix node in the key prefix hierarchy. for eg. Bigtable keyspaces are lexicographically ordered mappings of keys to values. Keys often have a shared prefix structure where users use the keys to organize data. Eg ///employee In this case Keysight will possibly use one node for a company and reuse it for all employees that fall under the company. Doing so improves legibility in the UI.

ProjectsInstanceConfigOperationsListOptions

Additional options for Spanner#projectsInstanceConfigOperationsList.

ProjectsInstanceConfigsDeleteOptions

Additional options for Spanner#projectsInstanceConfigsDelete.

ProjectsInstanceConfigsListOptions

Additional options for Spanner#projectsInstanceConfigsList.

ProjectsInstanceConfigsOperationsListOptions

Additional options for Spanner#projectsInstanceConfigsOperationsList.

ProjectsInstanceConfigsSsdCachesOperationsListOptions

Additional options for Spanner#projectsInstanceConfigsSsdCachesOperationsList.

ProjectsInstancesBackupOperationsListOptions

Additional options for Spanner#projectsInstancesBackupOperationsList.

ProjectsInstancesBackupsCreateOptions

Additional options for Spanner#projectsInstancesBackupsCreate.

ProjectsInstancesBackupsListOptions

Additional options for Spanner#projectsInstancesBackupsList.

ProjectsInstancesBackupsOperationsListOptions

Additional options for Spanner#projectsInstancesBackupsOperationsList.

ProjectsInstancesBackupsPatchOptions

Additional options for Spanner#projectsInstancesBackupsPatch.

ProjectsInstancesDatabaseOperationsListOptions

Additional options for Spanner#projectsInstancesDatabaseOperationsList.

ProjectsInstancesDatabasesDatabaseRolesListOptions

Additional options for Spanner#projectsInstancesDatabasesDatabaseRolesList.

ProjectsInstancesDatabasesGetScansOptions

Additional options for Spanner#projectsInstancesDatabasesGetScans.

ProjectsInstancesDatabasesListOptions

Additional options for Spanner#projectsInstancesDatabasesList.

ProjectsInstancesDatabasesOperationsListOptions

Additional options for Spanner#projectsInstancesDatabasesOperationsList.

ProjectsInstancesDatabasesPatchOptions

Additional options for Spanner#projectsInstancesDatabasesPatch.

ProjectsInstancesDatabasesSessionsListOptions

Additional options for Spanner#projectsInstancesDatabasesSessionsList.

ProjectsInstancesGetOptions

Additional options for Spanner#projectsInstancesGet.

ProjectsInstancesInstancePartitionOperationsListOptions

Additional options for Spanner#projectsInstancesInstancePartitionOperationsList.

ProjectsInstancesInstancePartitionsDeleteOptions

Additional options for Spanner#projectsInstancesInstancePartitionsDelete.

ProjectsInstancesInstancePartitionsListOptions

Additional options for Spanner#projectsInstancesInstancePartitionsList.

ProjectsInstancesInstancePartitionsOperationsListOptions

Additional options for Spanner#projectsInstancesInstancePartitionsOperationsList.

ProjectsInstancesListOptions

Additional options for Spanner#projectsInstancesList.

ProjectsInstancesOperationsListOptions

Additional options for Spanner#projectsInstancesOperationsList.

QueryAdvisorResult

Output of query advisor analysis.

QueryOptions

Query optimizer configuration.

QueryPlan

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

ReadOnly

Message type to initiate a read-only transaction.

ReadRequest

The request for Read and StreamingRead.

ReadWrite

Message type to initiate a read-write transaction. Currently this transaction type has no options.

ReplicaInfo
ReplicaSelection

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.

RequestOptions

Common request options for various APIs.

RestoreDatabaseEncryptionConfig

Encryption configuration for the restored database.

RestoreDatabaseMetadata

Metadata type for the long-running operation returned by RestoreDatabase.

RestoreDatabaseRequest

The request for RestoreDatabase.

RestoreInfo

Information about the database restore.

ResultSet

Results from Read or ExecuteSql.

ResultSetMetadata

Metadata about a ResultSet or PartialResultSet.

ResultSetStats

Additional statistics about a ResultSet or PartialResultSet.

RollbackRequest

The request for Rollback.

Scan

Scan is a structure which describes Cloud Key Visualizer scan information.

ScanData

ScanData contains Cloud Key Visualizer scan data used by the caller to construct a visualization.

ScansListOptions

Additional options for Spanner#scansList.

Session

A session in the Cloud Spanner API.

SetIamPolicyRequest

Request message for SetIamPolicy method.

ShortRepresentation

Condensed representation of a node and its subtree. Only present for SCALAR PlanNode(s).

Statement

A single DML statement.

Status

The Status type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC. Each Status message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the API Design Guide.

StructType

StructType defines the fields of a STRUCT type.

TestIamPermissionsRequest

Request message for TestIamPermissions method.

TestIamPermissionsResponse

Response message for TestIamPermissions method.

Transaction

A transaction.

TransactionOptions

Transactions: Each session can have at most one active transaction at a time (note that standalone reads and queries use a transaction internally and do count towards the one transaction limit). After the active transaction is completed, the session can immediately be re-used for the next transaction. It is not necessary to create a new session for each transaction. Transaction modes: Cloud Spanner supports three transaction modes: 1. Locking read-write. This type of transaction is the only way to write data into Cloud Spanner. These transactions rely on pessimistic locking and, if necessary, two-phase commit. Locking read-write transactions may abort, requiring the application to retry. 2. Snapshot read-only. Snapshot read-only transactions provide guaranteed consistency across several reads, but do not allow writes. Snapshot read-only transactions can be configured to read at timestamps in the past, or configured to perform a strong read (where Spanner will select a timestamp such that the read is guaranteed to see the effects of all transactions that have committed before the start of the read). Snapshot read-only transactions do not need to be committed. Queries on change streams must be performed with the snapshot read-only transaction mode, specifying a strong read. Please see TransactionOptions.ReadOnly.strong for more details. 3. Partitioned DML. This type of transaction is used to execute a single Partitioned DML statement. Partitioned DML partitions the key space and runs the DML statement over each partition in parallel using separate, internal transactions that commit independently. Partitioned DML transactions do not need to be committed. For transactions that only read, snapshot read-only transactions provide simpler semantics and are almost always faster. In particular, read-only transactions do not take locks, so they do not conflict with read-write transactions. As a consequence of not taking locks, they also do not abort, so retry loops are not needed. Transactions may only read-write data in a single database. They may, however, read-write data in different tables within that database. Locking read-write transactions: Locking transactions may be used to atomically read-modify-write data anywhere in a database. This type of transaction is externally consistent. Clients should attempt to minimize the amount of time a transaction is active. Faster transactions commit with higher probability and cause less contention. Cloud Spanner attempts to keep read locks active as long as the transaction continues to do reads, and the transaction has not been terminated by Commit or Rollback. Long periods of inactivity at the client may cause Cloud Spanner to release a transaction's locks and abort it. Conceptually, a read-write transaction consists of zero or more reads or SQL statements followed by Commit. At any time before Commit, the client can send a Rollback request to abort the transaction. Semantics: Cloud Spanner can commit the transaction if all read locks it acquired are still valid at commit time, and it is able to acquire write locks for all writes. Cloud Spanner can abort the transaction for any reason. If a commit attempt returns ABORTED, Cloud Spanner guarantees that the transaction has not modified any user data in Cloud Spanner. Unless the transaction commits, Cloud Spanner makes no guarantees about how long the transaction's locks were held for. It is an error to use Cloud Spanner locks for any sort of mutual exclusion other than between Cloud Spanner transactions themselves. Retrying aborted transactions: When a transaction aborts, the application can choose to retry the whole transaction again. To maximize the chances of successfully committing the retry, the client should execute the retry in the same session as the original attempt. The original session's lock priority increases with each consecutive abort, meaning that each attempt has a slightly better chance of success than the previous. Under some circumstances (for example, many transactions attempting to modify the same row(s)), a transaction can abort many times in a short period before successfully committing. Thus, it is not a good idea to cap the number of retries a transaction can attempt; instead, it is better to limit the total amount of time spent retrying. Idle transactions: A transaction is considered idle if it has no outstanding reads or SQL queries and has not started a read or SQL query within the last 10 seconds. Idle transactions can be aborted by Cloud Spanner so that they don't hold on to locks indefinitely. If an idle transaction is aborted, the commit will fail with error ABORTED. If this behavior is undesirable, periodically executing a simple SQL query in the transaction (for example, SELECT 1) prevents the transaction from becoming idle. Snapshot read-only transactions: Snapshot read-only transactions provides a simpler method than locking read-write transactions for doing several consistent reads. However, this type of transaction does not support writes. Snapshot transactions do not take locks. Instead, they work by choosing a Cloud Spanner timestamp, then executing all reads at that timestamp. Since they do not acquire locks, they do not block concurrent read-write transactions. Unlike locking read-write transactions, snapshot read-only transactions never abort. They can fail if the chosen read timestamp is garbage collected; however, the default garbage collection policy is generous enough that most applications do not need to worry about this in practice. Snapshot read-only transactions do not need to call Commit or Rollback (and in fact are not permitted to do so). To execute a snapshot transaction, the client specifies a timestamp bound, which tells Cloud Spanner how to choose a read timestamp. The types of timestamp bound are: - Strong (the default). - Bounded staleness. - Exact staleness. If the Cloud Spanner database to be read is geographically distributed, stale read-only transactions can execute more quickly than strong or read-write transactions, because they are able to execute far from the leader replica. Each type of timestamp bound is discussed in detail below. Strong: Strong reads are guaranteed to see the effects of all transactions that have committed before the start of the read. Furthermore, all rows yielded by a single read are consistent with each other -- if any part of the read observes a transaction, all parts of the read see the transaction. Strong reads are not repeatable: two consecutive strong read-only transactions might return inconsistent results if there are concurrent writes. If consistency across reads is required, the reads should be executed within a transaction or at an exact read timestamp. Queries on change streams (see below for more details) must also specify the strong read timestamp bound. See TransactionOptions.ReadOnly.strong. Exact staleness: These timestamp bounds execute reads at a user-specified timestamp. Reads at a timestamp are guaranteed to see a consistent prefix of the global transaction history: they observe modifications done by all transactions with a commit timestamp less than or equal to the read timestamp, and observe none of the modifications done by transactions with a larger commit timestamp. They will block until all conflicting transactions that may be assigned commit timestamps <= the read timestamp have finished. The timestamp can either be expressed as an absolute Cloud Spanner commit timestamp or a staleness relative to the current time. These modes do not require a "negotiation phase" to pick a timestamp. As a result, they execute slightly faster than the equivalent boundedly stale concurrency modes. On the other hand, boundedly stale reads usually return fresher results. See TransactionOptions.ReadOnly.read_timestamp and TransactionOptions.ReadOnly.exact_staleness. Bounded staleness: Bounded staleness modes allow Cloud Spanner to pick the read timestamp, subject to a user-provided staleness bound. Cloud Spanner chooses the newest timestamp within the staleness bound that allows execution of the reads at the closest available replica without blocking. All rows yielded are consistent with each other -- if any part of the read observes a transaction, all parts of the read see the transaction. Boundedly stale reads are not repeatable: two stale reads, even if they use the same staleness bound, can execute at different timestamps and thus return inconsistent results. Boundedly stale reads execute in two phases: the first phase negotiates a timestamp among all replicas needed to serve the read. In the second phase, reads are executed at the negotiated timestamp. As a result of the two phase execution, bounded staleness reads are usually a little slower than comparable exact staleness reads. However, they are typically able to return fresher results, and are more likely to execute at the closest replica. Because the timestamp negotiation requires up-front knowledge of which rows will be read, it can only be used with single-use read-only transactions. See TransactionOptions.ReadOnly.max_staleness and TransactionOptions.ReadOnly.min_read_timestamp. Old read timestamps and garbage collection: Cloud Spanner continuously garbage collects deleted and overwritten data in the background to reclaim storage space. This process is known as "version GC". By default, version GC reclaims versions after they are one hour old. Because of this, Cloud Spanner cannot perform reads at read timestamps more than one hour in the past. This restriction also applies to in-progress reads and/or SQL queries whose timestamp become too old while executing. Reads and SQL queries with too-old read timestamps fail with the error FAILED_PRECONDITION. You can configure and extend the VERSION_RETENTION_PERIOD of a database up to a period as long as one week, which allows Cloud Spanner to perform reads up to one week in the past. Querying change Streams: A Change Stream is a schema object that can be configured to watch data changes on the entire database, a set of tables, or a set of columns in a database. When a change stream is created, Spanner automatically defines a corresponding SQL Table-Valued Function (TVF) that can be used to query the change records in the associated change stream using the ExecuteStreamingSql API. The name of the TVF for a change stream is generated from the name of the change stream: READ_. All queries on change stream TVFs must be executed using the ExecuteStreamingSql API with a single-use read-only transaction with a strong read-only timestamp_bound. The change stream TVF allows users to specify the start_timestamp and end_timestamp for the time range of interest. All change records within the retention period is accessible using the strong read-only timestamp_bound. All other TransactionOptions are invalid for change stream queries. In addition, if TransactionOptions.read_only.return_read_timestamp is set to true, a special value of 2^63 - 2 will be returned in the Transaction message that describes the transaction, instead of a valid read timestamp. This special value should be discarded and not used for any subsequent queries. Please see https://cloud.google.com/spanner/docs/change-streams for more details on how to query the change stream TVFs. Partitioned DML transactions: Partitioned DML transactions are used to execute DML statements with a different execution strategy that provides different, and often better, scalability properties for large, table-wide operations than DML in a ReadWrite transaction. Smaller scoped statements, such as an OLTP workload, should prefer using ReadWrite transactions. Partitioned DML partitions the keyspace and runs the DML statement on each partition in separate, internal transactions. These transactions commit automatically when complete, and run independently from one another. To reduce lock contention, this execution strategy only acquires read locks on rows that match the WHERE clause of the statement. Additionally, the smaller per-partition transactions hold locks for less time. That said, Partitioned DML is not a drop-in replacement for standard DML used in ReadWrite transactions. - The DML statement must be fully-partitionable. Specifically, the statement must be expressible as the union of many statements which each access only a single row of the table. - The statement is not applied atomically to all rows of the table. Rather, the statement is applied atomically to partitions of the table, in independent transactions. Secondary index rows are updated atomically with the base table rows. - Partitioned DML does not guarantee exactly-once execution semantics against a partition. The statement will be applied at least once to each partition. It is strongly recommended that the DML statement should be idempotent to avoid unexpected results. For instance, it is potentially dangerous to run a statement such as UPDATE table SET column = column + 1 as it could be run multiple times against some rows. - The partitions are committed automatically - there is no support for Commit or Rollback. If the call returns an error, or if the client issuing the ExecuteSql call dies, it is possible that some rows had the statement executed on them successfully. It is also possible that statement was never executed against other rows. - Partitioned DML transactions may only contain the execution of a single DML statement via ExecuteSql or ExecuteStreamingSql. - If any error is encountered during the execution of the partitioned DML operation (for instance, a UNIQUE INDEX violation, division by zero, or a value that cannot be stored due to schema constraints), then the operation is stopped at that point and an error is returned. It is possible that at this point, some partitions have been committed (or even committed multiple times), and other partitions have not been run at all. Given the above, Partitioned DML is good fit for large, database-wide, operations that are idempotent, such as deleting old rows from a very large table.

TransactionSelector

This message is used to select the transaction in which a Read or ExecuteSql call runs. See TransactionOptions for more information about transactions.

Type

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

UpdateDatabaseDdlMetadata

Metadata type for the operation returned by UpdateDatabaseDdl.

UpdateDatabaseDdlRequest

Enqueues the given DDL statements to be applied, in order but not necessarily all at once, to the database schema at some point (or points) in the future. The server checks that the statements are executable (syntactically valid, name tables that exist, etc.) before enqueueing them, but they may still fail upon later execution (e.g., if a statement from another batch of statements is applied first and it conflicts in some way, or if there is some data-related problem like a NULL value in a column to which NOT NULL would be added). If a statement fails, all subsequent statements in the batch are automatically cancelled. Each batch of statements is assigned a name which can be used with the Operations API to monitor progress. See the operation_id field for more details.

UpdateDatabaseMetadata

Metadata type for the operation returned by UpdateDatabase.

UpdateDatabaseRequest

The request for UpdateDatabase.

UpdateInstanceConfigMetadata

Metadata type for the operation returned by UpdateInstanceConfig.

UpdateInstanceConfigRequest

The request for UpdateInstanceConfigRequest.

UpdateInstanceMetadata

Metadata type for the operation returned by UpdateInstance.

UpdateInstancePartitionMetadata

Metadata type for the operation returned by UpdateInstancePartition.

UpdateInstancePartitionRequest

The request for UpdateInstancePartition.

UpdateInstanceRequest

The request for UpdateInstance.

VisualizationData
Write

Arguments to insert, update, insert_or_update, and replace operations.