Global

Members

(constant) gapicConfig

Client JSON configuration object, loaded from src/v1/database_admin_client_config.json. This file defines retry strategy and timeouts for all API methods in this library.

(constant) gapicConfig

Client JSON configuration object, loaded from src/v1/instance_admin_client_config.json. This file defines retry strategy and timeouts for all API methods in this library.

(constant) gapicConfig

Client JSON configuration object, loaded from src/v1/spanner_client_config.json. This file defines retry strategy and timeouts for all API methods in this library.

(constant) protos :object

Properties:
Name Type Description
DatabaseAdminClient constructor

Reference to v1.DatabaseAdminClient

InstanceAdminClient constructor

Reference to v1.InstanceAdminClient

SpannerClient constructor

Reference to v1.SpannerClient

Methods

addLeaderAwareRoutingHeader(headers)

Add Leader aware routing header to existing header list.

Parameters:
Name Type Description
headers

Existing header list.

isCreateSessionPermissionError(error) → {boolean}

Checks whether the given error is a 'Create session permission' error.

Parameters:
Name Type Description
error Error

The error to check.

Returns:
Type Description
boolean

True if the error is a 'Create session permission' error, and otherwise false.

isDatabaseNotFoundError(error) → {boolean}

Checks whether the given error is a 'Database not found' error.

Parameters:
Name Type Description
error Error

The error to check.

Returns:
Type Description
boolean

True if the error is a 'Database not found' error, and otherwise false.

isDefaultCredentialsNotSetError(error) → {boolean}

Checks whether the given error is a 'Could not load the default credentials' error.

Parameters:
Name Type Description
error Error

The error to check.

Returns:
Type Description
boolean

True if the error is a 'Could not load the default credentials' error, and otherwise false.

isInstanceNotFoundError(error) → {boolean}

Checks whether the given error is an 'Instance not found' error.

Parameters:
Name Type Description
error Error

The error to check.

Returns:
Type Description
boolean

True if the error is an 'Instance not found' error, and otherwise false.

isProjectIdNotSetInEnvironmentError(error) → {boolean}

Checks whether the given error is an 'Unable to detect a Project Id in the current environment' error.

Parameters:
Name Type Description
error Error

The error to check.

Returns:
Type Description
boolean

True if the error is an 'Unable to detect a Project Id in the current environment' error, and otherwise false.

isRetryableInternalError(error)

Checks whether the given error is a retryable internal error.

Parameters:
Name Type Description
error

the error to check

Returns:
Type Description

true if the error is a retryable internal error, and otherwise false.

isSessionNotFoundError(error)

Checks whether the given error is a 'Session not found' error.

Parameters:
Name Type Description
error

the error to check

Returns:
Type Description

true if the error is a 'Session not found' error, and otherwise false.

Type Definitions

AsyncRunTransactionCallback(transaction)

Parameters:
Name Type Description
transaction Transaction

The transaction object. The transaction has already been created, and is ready to be queried and committed against.

CopyBackupCallback(sourceBackupId, backupId) → {Backup}

Parameters:
Name Type Description
sourceBackupId string

Full path of the source backup to be copied.

backupId string

The name of the backup.

CopyBackupOptions
Returns:
Type Description
Backup

A Backup object.

Example
```
const {Spanner} = require('@google-cloud/spanner');
const spanner = new Spanner();
const instance = spanner.instance('my-instance');
const backup = instance.copyBackup('my-source-backup','my-backup',{
  expireTime: expireTime,
  encryptionConfig: {
    encryptionType: 'CUSTOMER_MANAGED_ENCRYPTION',
    kmsKeyName: 'projects/my-project-id/my-region/keyRings/my-key-ring/cryptoKeys/my-key',
  },);
```

CopyBackupOptions

Get a reference to a Backup object.

CreateQueryPartitionsCallback(errnullable, partitions, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

partitions Array.<QueryPartition>

List of query partitions.

apiResponse object

The full API response.

CreateQueryPartitionsResponse

Properties:
Name Type Description
0 Array.<QueryPartition>

List of query partitions.

1 object

The full API response.

CreateReadPartitionsCallback(errnullable, partitions, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

partitions Array.<ReadPartition>

List of read partitions.

apiResponse object

The full API response.

CreateReadPartitionsResponse

Properties:
Name Type Description
0 Array.<ReadPartition>

List of read partitions.

1 object

The full API response.

CreateSessionCallback(errnullable, session, apiResponse)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

session Session

The Session.

apiResponse object

The full API response.

ExecuteSqlRequest

ExecuteSql request options. This includes all standard ExecuteSqlRequest options as well as several convenience properties.

Properties:
Name Type Attributes Default Description
resumeToken string

The token used to resume getting results.

queryMode google.spanner.v1.ExecuteSqlRequest.QueryMode

Query plan and execution statistics for the SQL statement that produced this result set.

partitionToken string

The partition token.

seqno number

The Sequence number. This option is used internally and will be overridden.

sql string

The SQL string.

queryOptions google.spanner.v1.ExecuteSqlRequest.IQueryOptions <optional>

Default query options to use with the database. These options will be overridden by any query options set in environment variables or that are specified on a per-query basis.

requestOptions google.spanner.v1.IRequestOptions

The request options to include with the commit request.

params Object.<string, *> <optional>

A map of parameter names to values.

types Object.<string, (string|ParamType)> <optional>

A map of parameter names to types. If omitted the client will attempt to guess for all non-null values.

json boolean <optional>
false

Receive the rows as serialized objects. This is the equivalent of calling toJSON() on each row.

jsonOptions JSONOptions <optional>

Configuration options for the serialized objects.

gaxOptions object <optional>

Request configuration options, See CallOptions for more details.

maxResumeRetries number <optional>

The maximum number of times that the stream will retry to push data downstream, when the downstream indicates that it is not ready for any more data. Increase this value if you experience 'Stream is still not ready to receive data' errors as a result of a slow writer in your receiving stream.

directedReadOptions object <optional>

Indicates which replicas or regions should be used for non-transactional reads or queries.

See:

Float

See:

GetSessionResponse

Properties:
Name Type Description
0 Session

The Session.

1 object

The full API response.

Int

See:

JSONOptions

Properties:
Name Type Attributes Default Description
wrapNumbers boolean <optional>
false

Indicates if the numbers should be wrapped in Int/Float wrappers.

wrapStructs boolean <optional>
false

Indicates if the structs should be wrapped in Struct wrapper.

includeNameless boolean <optional>
false

Indicates if nameless columns should be included in the result. If true, nameless columns will be assigned the name '_{column_index}'.

KeyRange

A 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 an array of strings where the nth value in the list corresponds to the nth component of the table or index primary key.

Properties:
Name Type Attributes Description
startClosed Array.<string> <optional>

If the start is closed, then the range includes all rows whose first key columns exactly match.

startOpen Array.<string> <optional>

If the start is open, then the range excludes rows whose first key columns exactly match.

endClosed Array.<string> <optional>

If the end is closed, then the range includes all rows whose first key columns exactly match.

endOpen Array.<string> <optional>

If the end is open, then the range excludes rows whose first key columns exactly match.

Numeric

See:

PGJsonb

See:

PGNumeric

See:

PGOid

See:
  • Spanner.pgOid

ParamType

Properties:
Name Type Attributes Description
type string

The param type. Must be one of the following: - float64 - int64 - numeric - bool - string - bytes - json - timestamp - date - struct - array

fields Array.<StructField> <optional>

For struct types only. Type definitions for the individual fields.

child string | ParamType <optional>

For array types only. The array element type.

QueryPartition

Properties:
Name Type Description
partitionToken string

The partition token.

See:

ReadPartition

Properties:
Name Type Attributes Description
partitionToken string

The partition token.

gaxOptions object <optional>

Request configuration options, See CallOptions for more details.

Mixes In:
  • ReadRequestOptions

ReadRequest

Read request options. This includes all standard ReadRequest options as well as several convenience properties.

Properties:
Name Type Attributes Default Description
table string

The name of the table in the database to be read.

columns Array.<string>

The columns of the table to be returned for each row matching this query.

keys Array.<string> | Array.<Array.<string>>

The primary or index keys of the rows in this table to be yielded. If using a composite key, provide an array within this array. See the example below.

ranges Array.<KeyRange> <optional>

An alternative to the keys property; this can be used to define a range of keys to be yielded.

index string <optional>

The name of an index on the table if a different index than the primary key should be used to determine which rows to return.

json boolean <optional>
false

Receive the rows as serialized objects. This is the equivalent of calling toJSON() on each row.

jsonOptions JSONOptions <optional>

Configuration options for the serialized objects.

keySet object <optional>

Defines a collection of keys and/or key ranges to read.

limit number <optional>

The number of rows to yield.

partitionToken Buffer <optional>

If present, results will be restricted to the specified partition previously created using PartitionRead(). There must be an exact match for the values of fields common to this message and the PartitionReadRequest message used to create this partition_token.

requestOptions google.spanner.v1.RequestOptions <optional>

Common options for this request.

directedReadOptions google.spanner.v1.IDirectedReadOptions <optional>

Indicates which replicas or regions should be used for non-transactional reads or queries.

gaxOptions object <optional>

Call options. See CallOptions for more details.

See:

SessionExistsCallback(errnullable, exists)

Parameters:
Name Type Attributes Description
err Error <nullable>

Request error, if any.

exists boolean

Whether the Session exists.

SessionExistsResponse

Properties:
Name Type Description
0 boolean

Whether the Session exists.

Struct

See:

StructField

Properties:
Name Type Description
name string

The name of the field.

TimestampBounds

Properties:
Name Type Attributes Default Description
strong boolean <optional>
true

Read at a timestamp where all previously committed transactions are visible.

minReadTimestamp external:PreciseDate | google.protobuf.Timestamp <optional>

Executes all reads at a timestamp >= minReadTimestamp.

maxStaleness number | google.protobuf.Timestamp <optional>

Read data at a timestamp >= NOW - maxStaleness (milliseconds).

readTimestamp external:PreciseDate | google.protobuf.Timestamp <optional>

Executes all reads at the given timestamp.

exactStaleness number | google.protobuf.Timestamp <optional>

Executes all reads at a timestamp that is exactStaleness (milliseconds) old.

returnReadTimestamp boolean <optional>
true

When true, Snapshot#readTimestamp will be populated after Snapshot#begin is called.

TransactionIdentifier

Properties:
Name Type Description
session string | Session

The full session name.

transaction string

The transaction ID.

readTimestamp string | Date

The transaction read timestamp.