Package @google-cloud/spanner (9.1.0)

Classes

Backup

The Backup class represents a Cloud Spanner backup.

Create a Backup object to interact with or create a Cloud Spanner backup or copy a backup.

Database

Create a Database object to interact with a Cloud Spanner database.

Float

Float

Float32

Float32

Instance

The Instance class represents a [Cloud Spanner instance](https://cloud.google.com/spanner/docs/instances).

Create an Instance object to interact with a Cloud Spanner instance.

InstanceConfig

The InstanceConfig class represents a possible configuration for a Cloud Spanner instance.

Create an InstanceConfig object to interact with a Cloud Spanner instance config.

Int

Int

Interval

Interval

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.

This object is created and returned from .

MutationSet

MutationSet represent a set of changes to be applied atomically to a Cloud Spanner database with a Transaction. Mutations are used to insert, update, upsert(insert or update), replace, or delete rows within tables.

Mutations are added to a Transaction and are not executed until the transaction is committed via .

If the transaction is rolled back or encounters an error, the mutations are discarded.

Numeric

Numeric

PartitionedDml

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.

Chances are, you'll never need to create a partitioned DML transaction directly, instead you'll want to use .

Snapshot

PGNumeric

PGNumeric

Session

Create a Session object to interact with a Cloud Spanner session.

**It is unlikely you will need to interact with sessions directly. By default, sessions are created and utilized for maximum performance automatically.**

SessionPool

*

Snapshot

This transaction type provides guaranteed consistency across several reads, but does not allow writes. Snapshot read-only transactions can be configured to read at timestamps in the past.

When finished with the Snapshot, call to release the underlying Session. Failure to do so can result in a Session leak.

**This object is created and returned from .**

Spanner

[Cloud Spanner](https://cloud.google.com/spanner) is a highly scalable, transactional, managed, NewSQL database service. Cloud Spanner solves the need for a horizontally-scaling database with consistent global transaction and SQL semantics. With Cloud Spanner you don't need to choose between consistency and horizontal scaling — you get both.

SpannerDate

Date-like object used to represent Cloud Spanner Dates. DATE types represent a logical calendar date, independent of time zone. DATE values do not represent a specific 24-hour period. Rather, a given DATE value represents a different 24-hour period when interpreted in a different time zone. Because of this, all values passed to will be interpreted as local time.

To represent an absolute point in time, use Spanner.timestamp().

Struct

Struct

Table

Create a Table object to interact with a table in a Cloud Spanner database.

Transaction

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.

Calling either or signals that the transaction is finished and no further requests will be made. If for some reason you decide not to call one of the aformentioned methods, call to release the underlying Session.

Running a transaction via or automatically re-runs the transaction on ABORTED errors.

returns a plain Transaction object, requiring the user to retry manually.

Snapshot

Interfaces

CreateInstanceConfigRequest

CreateInstanceRequest

GetInstanceConfigOptions

ObservabilityOptions

RequestConfig

SpannerOptions

Session pool configuration options. {boolean} [routeToLeaderEnabled=True] If set to false leader aware routing will be disabled. Disabling leader aware routing would route all requests in RW/PDML transactions to any region. {google.spanner.v1.IDirectedReadOptions} [directedReadOptions] Sets the DirectedReadOptions for all ReadRequests and ExecuteSqlRequests for the Client. Indicates which replicas or regions should be used for non-transactional reads or queries. DirectedReadOptions won't be set for readWrite transactions" {ObservabilityOptions} [observabilityOptions] Sets the observability options to be used for OpenTelemetry tracing {boolean} [disableBuiltInMetrics=True] If set to true, built-in metrics will be disabled. {number} ['grpc.enable_channelz'=0] Whether to enable gRPC Channelz service tracking. Defaults to 0 (disabled) to eliminate per-RPC tracking and allocation overhead. Set to 1 to enable.

Variables

_default

_default: {
    Spanner: typeof Spanner;
}

Type Aliases

EnumKey

export type EnumKey

Translates enum values to string keys.

Type Parameter
Type Description
E

GetInstanceConfigCallback

export type GetInstanceConfigCallback = NormalCallback

GetInstanceConfigOperationsCallback

export type GetInstanceConfigOperationsCallback = PagedCallback

GetInstanceConfigOperationsOptions

export type GetInstanceConfigOperationsOptions = PagedOptionsWithFilter;

GetInstanceConfigOperationsResponse

export type GetInstanceConfigOperationsResponse = PagedResponse

GetInstanceConfigResponse

export type GetInstanceConfigResponse = [IInstanceConfig];

GetInstanceConfigsCallback

export type GetInstanceConfigsCallback = PagedCallback

GetInstanceConfigsOptions

export type GetInstanceConfigsOptions = PagedOptions;

GetInstanceConfigsResponse

export type GetInstanceConfigsResponse = PagedResponse

GetInstancesCallback

export type GetInstancesCallback = PagedCallback

GetInstancesOptions

export type GetInstancesOptions = PagedOptionsWithFilter;

GetInstancesResponse

export type GetInstancesResponse = PagedResponse

IOperation

export type IOperation = instanceAdmin.longrunning.IOperation;

TranslateEnumKeys

export type TranslateEnumKeys

Translates an enum property of an object from enum value to enum key, leaving all other properties as-is.

Type Parameters
Type Description
T
U
E