Cloud Spanner API
The Cloud Spanner API can be used to manage sessions and execute transactions on data stored in Cloud Spanner databases. v1
Package
@google-cloud/spannerConstructors
(constructor)(opts, gaxInstance)
constructor
(
opts
?:
ClientOptions
,
gaxInstance
?:
typeof
gax
|
typeof
gax
.
fallback
);
Construct an instance of SpannerClient.
opts
ClientOptions
gaxInstance
typeof gax
| typeof fallback
: loaded instance of google-gax
. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new SpannerClient({fallback: true}, gax); ```
Properties
apiEndpoint
static
get
apiEndpoint
()
:
string
;
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
auth
auth
:
gax
.
GoogleAuth
;
descriptors
descriptors
:
Descriptors
;
innerApiCalls
innerApiCalls
:
{
[
name
:
string
]
:
Function
;
};
pathTemplates
pathTemplates
:
{
[
name
:
string
]
:
gax
.
PathTemplate
;
};
port
static
get
port
()
:
number
;
The port for this API service.
scopes
static
get
scopes
()
:
string
[];
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static
get
servicePath
()
:
string
;
The DNS address for this API service.
spannerStub
spannerStub
?:
Promise
< {
[
name
:
string
]
:
Function
;
}>;
warn
warn
:
(
code
:
string
,
message
:
string
,
warnType
?:
string
)
=
>
void
;
Methods
batchCreateSessions(request, options)
batchCreateSessions
(
request
?:
protos
.
google
.
spanner
.
v1
.
IBatchCreateSessionsRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
spanner
.
v1
.
IBatchCreateSessionsResponse
,
protos
.
google
.
spanner
.
v1
.
IBatchCreateSessionsRequest
|
undefined
,
{}
|
undefined
]>;
Creates multiple new sessions.
This API can be used to initialize a session cache on the clients. See https://goo.gl/TgSFN2 for best practices on session cache management.
request
options
Promise
<[ protos.google.spanner.v1.IBatchCreateSessionsResponse
, protos.google.spanner.v1.IBatchCreateSessionsRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing BatchCreateSessionsResponse . Please see the documentation for more details and examples.
batchCreateSessions(request, options, callback)
batchCreateSessions
(
request
:
protos
.
google
.
spanner
.
v1
.
IBatchCreateSessionsRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
IBatchCreateSessionsResponse
,
protos
.
google
.
spanner
.
v1
.
IBatchCreateSessionsRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.spanner.v1.IBatchCreateSessionsResponse
, protos.google.spanner.v1.IBatchCreateSessionsRequest
| null | undefined, {} | null | undefined>
void
batchCreateSessions(request, callback)
batchCreateSessions
(
request
:
protos
.
google
.
spanner
.
v1
.
IBatchCreateSessionsRequest
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
IBatchCreateSessionsResponse
,
protos
.
google
.
spanner
.
v1
.
IBatchCreateSessionsRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.spanner.v1.IBatchCreateSessionsResponse
, protos.google.spanner.v1.IBatchCreateSessionsRequest
| null | undefined, {} | null | undefined>
void
batchWrite(request, options)
batchWrite
(
request
?:
protos
.
google
.
spanner
.
v1
.
IBatchWriteRequest
,
options
?:
CallOptions
)
:
gax
.
CancellableStream
;
Batches the supplied mutation groups in a collection of efficient transactions. All mutations in a group are committed atomically. However, mutations across groups can be committed non-atomically in an unspecified order and thus, they must be independent of each other. Partial failure is possible, i.e., some groups may have been committed successfully, while some may have failed. The results of individual batches are streamed into the response as the batches are applied.
BatchWrite requests are not replay protected, meaning that each mutation group may be applied more than once. Replays of non-idempotent mutations may have undesirable effects. For example, replays of an insert mutation may produce an already exists error or if you use generated or commit timestamp-based keys, it may result in additional rows being added to the mutation's table. We recommend structuring your mutation groups to be idempotent to avoid this issue.
request
options
gax.CancellableStream
{Stream} An object stream which emits BatchWriteResponse on 'data' event. Please see the documentation for more details and examples.
beginTransaction(request, options)
beginTransaction
(
request
?:
protos
.
google
.
spanner
.
v1
.
IBeginTransactionRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
spanner
.
v1
.
ITransaction
,
protos
.
google
.
spanner
.
v1
.
IBeginTransactionRequest
|
undefined
,
{}
|
undefined
]>;
Begins a new transaction. This step can often be skipped: , and can begin a new transaction as a side-effect.
request
options
Promise
<[ protos.google.spanner.v1.ITransaction
, protos.google.spanner.v1.IBeginTransactionRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Transaction . Please see the documentation for more details and examples.
beginTransaction(request, options, callback)
beginTransaction
(
request
:
protos
.
google
.
spanner
.
v1
.
IBeginTransactionRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
ITransaction
,
protos
.
google
.
spanner
.
v1
.
IBeginTransactionRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.spanner.v1.ITransaction
, protos.google.spanner.v1.IBeginTransactionRequest
| null | undefined, {} | null | undefined>
void
beginTransaction(request, callback)
beginTransaction
(
request
:
protos
.
google
.
spanner
.
v1
.
IBeginTransactionRequest
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
ITransaction
,
protos
.
google
.
spanner
.
v1
.
IBeginTransactionRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.spanner.v1.ITransaction
, protos.google.spanner.v1.IBeginTransactionRequest
| null | undefined, {} | null | undefined>
void
close()
close
()
:
Promise<void>
;
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Promise
<void>
{Promise} A promise that resolves when the client is closed.
commit(request, options)
commit
(
request
?:
protos
.
google
.
spanner
.
v1
.
ICommitRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
spanner
.
v1
.
ICommitResponse
,
protos
.
google
.
spanner
.
v1
.
ICommitRequest
|
undefined
,
{}
|
undefined
]>;
Commits a transaction. The request includes the mutations to be applied to rows in the database.
Commit
might return an ABORTED
error. This can occur at any time; commonly, the cause is conflicts with concurrent transactions. However, it can also happen for a variety of other reasons. If Commit
returns ABORTED
, the caller should re-attempt the transaction from the beginning, re-using the same session.
On very rare occasions, Commit
might return UNKNOWN
. This can happen, for example, if the client job experiences a 1+ hour networking failure. At that point, Cloud Spanner has lost track of the transaction outcome and we recommend that you perform another read from the database to see the state of things as they are now.
request
options
Promise
<[ protos.google.spanner.v1.ICommitResponse
, protos.google.spanner.v1.ICommitRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.
commit(request, options, callback)
commit
(
request
:
protos
.
google
.
spanner
.
v1
.
ICommitRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
ICommitResponse
,
protos
.
google
.
spanner
.
v1
.
ICommitRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.spanner.v1.ICommitResponse
, protos.google.spanner.v1.ICommitRequest
| null | undefined, {} | null | undefined>
void
commit(request, callback)
commit
(
request
:
protos
.
google
.
spanner
.
v1
.
ICommitRequest
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
ICommitResponse
,
protos
.
google
.
spanner
.
v1
.
ICommitRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.spanner.v1.ICommitResponse
, protos.google.spanner.v1.ICommitRequest
| null | undefined, {} | null | undefined>
void
createSession(request, options)
createSession
(
request
?:
protos
.
google
.
spanner
.
v1
.
ICreateSessionRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
spanner
.
v1
.
ISession
,
protos
.
google
.
spanner
.
v1
.
ICreateSessionRequest
|
undefined
,
{}
|
undefined
]>;
Creates a new session. A session can be used to perform transactions that read and/or modify data in a Cloud Spanner database. Sessions are meant to be reused for many consecutive transactions.
Sessions can only execute one transaction at a time. To execute multiple concurrent read-write/write-only transactions, create multiple sessions. Note that standalone reads and queries use a transaction internally, and count toward the one transaction limit.
Active sessions use additional server resources, so it is a good idea to delete idle and unneeded sessions. Aside from explicit deletes, Cloud Spanner may delete sessions for which no operations are sent for more than an hour. If a session is deleted, requests to it return NOT_FOUND
.
Idle sessions can be kept alive by sending a trivial SQL query periodically, e.g., "SELECT 1"
.
request
options
Promise
<[ protos.google.spanner.v1.ISession
, protos.google.spanner.v1.ICreateSessionRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Session . Please see the documentation for more details and examples.
createSession(request, options, callback)
createSession
(
request
:
protos
.
google
.
spanner
.
v1
.
ICreateSessionRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
ISession
,
protos
.
google
.
spanner
.
v1
.
ICreateSessionRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.spanner.v1.ISession
, protos.google.spanner.v1.ICreateSessionRequest
| null | undefined, {} | null | undefined>
void
createSession(request, callback)
createSession
(
request
:
protos
.
google
.
spanner
.
v1
.
ICreateSessionRequest
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
ISession
,
protos
.
google
.
spanner
.
v1
.
ICreateSessionRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.spanner.v1.ISession
, protos.google.spanner.v1.ICreateSessionRequest
| null | undefined, {} | null | undefined>
void
databasePath(project, instance, database)
databasePath
(
project
:
string
,
instance
:
string
,
database
:
string
)
:
string
;
Return a fully-qualified database resource name string.
project
string
instance
string
database
string
string
{string} Resource name string.
deleteSession(request, options)
deleteSession
(
request
?:
protos
.
google
.
spanner
.
v1
.
IDeleteSessionRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
protobuf
.
IEmpty
,
protos
.
google
.
spanner
.
v1
.
IDeleteSessionRequest
|
undefined
,
{}
|
undefined
]>;
Ends a session, releasing server resources associated with it. This will asynchronously trigger cancellation of any operations that are running with this session.
request
options
Promise
<[ protos.google.protobuf.IEmpty
, protos.google.spanner.v1.IDeleteSessionRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty . Please see the documentation for more details and examples.
deleteSession(request, options, callback)
deleteSession
(
request
:
protos
.
google
.
spanner
.
v1
.
IDeleteSessionRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
protobuf
.
IEmpty
,
protos
.
google
.
spanner
.
v1
.
IDeleteSessionRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.protobuf.IEmpty
, protos.google.spanner.v1.IDeleteSessionRequest
| null | undefined, {} | null | undefined>
void
deleteSession(request, callback)
deleteSession
(
request
:
protos
.
google
.
spanner
.
v1
.
IDeleteSessionRequest
,
callback
:
Callback<protos
.
google
.
protobuf
.
IEmpty
,
protos
.
google
.
spanner
.
v1
.
IDeleteSessionRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.protobuf.IEmpty
, protos.google.spanner.v1.IDeleteSessionRequest
| null | undefined, {} | null | undefined>
void
executeBatchDml(request, options)
executeBatchDml
(
request
?:
protos
.
google
.
spanner
.
v1
.
IExecuteBatchDmlRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
spanner
.
v1
.
IExecuteBatchDmlResponse
,
protos
.
google
.
spanner
.
v1
.
IExecuteBatchDmlRequest
|
undefined
,
{}
|
undefined
]>;
Executes a batch of SQL DML statements. This method allows many statements to be run with lower latency than submitting them sequentially with .
Statements are executed in sequential order. A request can succeed even if a statement fails. The ExecuteBatchDmlResponse.status field in the response provides information about the statement that failed. Clients must inspect this field to determine whether an error occurred.
Execution stops after the first failed statement; the remaining statements are not executed.
request
options
Promise
<[ protos.google.spanner.v1.IExecuteBatchDmlResponse
, protos.google.spanner.v1.IExecuteBatchDmlRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing ExecuteBatchDmlResponse . Please see the documentation for more details and examples.
executeBatchDml(request, options, callback)
executeBatchDml
(
request
:
protos
.
google
.
spanner
.
v1
.
IExecuteBatchDmlRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
IExecuteBatchDmlResponse
,
protos
.
google
.
spanner
.
v1
.
IExecuteBatchDmlRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.spanner.v1.IExecuteBatchDmlResponse
, protos.google.spanner.v1.IExecuteBatchDmlRequest
| null | undefined, {} | null | undefined>
void
executeBatchDml(request, callback)
executeBatchDml
(
request
:
protos
.
google
.
spanner
.
v1
.
IExecuteBatchDmlRequest
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
IExecuteBatchDmlResponse
,
protos
.
google
.
spanner
.
v1
.
IExecuteBatchDmlRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.spanner.v1.IExecuteBatchDmlResponse
, protos.google.spanner.v1.IExecuteBatchDmlRequest
| null | undefined, {} | null | undefined>
void
executeSql(request, options)
executeSql
(
request
?:
protos
.
google
.
spanner
.
v1
.
IExecuteSqlRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
spanner
.
v1
.
IResultSet
,
protos
.
google
.
spanner
.
v1
.
IExecuteSqlRequest
|
undefined
,
{}
|
undefined
]>;
Executes an SQL statement, returning all results in a single reply. This method cannot be used to return a result set larger than 10 MiB; if the query yields more data than that, the query fails with a FAILED_PRECONDITION
error.
Operations inside read-write transactions might return ABORTED
. If this occurs, the application should restart the transaction from the beginning. See Transaction
for more details.
Larger result sets can be fetched in streaming fashion by calling instead.
request
options
Promise
<[ protos.google.spanner.v1.IResultSet
, protos.google.spanner.v1.IExecuteSqlRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing ResultSet . Please see the documentation for more details and examples.
executeSql(request, options, callback)
executeSql
(
request
:
protos
.
google
.
spanner
.
v1
.
IExecuteSqlRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
IResultSet
,
protos
.
google
.
spanner
.
v1
.
IExecuteSqlRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.spanner.v1.IResultSet
, protos.google.spanner.v1.IExecuteSqlRequest
| null | undefined, {} | null | undefined>
void
executeSql(request, callback)
executeSql
(
request
:
protos
.
google
.
spanner
.
v1
.
IExecuteSqlRequest
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
IResultSet
,
protos
.
google
.
spanner
.
v1
.
IExecuteSqlRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.spanner.v1.IResultSet
, protos.google.spanner.v1.IExecuteSqlRequest
| null | undefined, {} | null | undefined>
void
executeStreamingSql(request, options)
executeStreamingSql
(
request
?:
protos
.
google
.
spanner
.
v1
.
IExecuteSqlRequest
,
options
?:
CallOptions
)
:
gax
.
CancellableStream
;
Like , except returns the result set as a stream. Unlike , there is no limit on the size of the returned result set. However, no individual row in the result set can exceed 100 MiB, and no column value can exceed 10 MiB.
request
options
gax.CancellableStream
{Stream} An object stream which emits PartialResultSet on 'data' event. Please see the documentation for more details and examples.
getProjectId()
getProjectId
()
:
Promise<string>
;
Promise
<string>
getProjectId(callback)
getProjectId
(
callback
:
Callback<string
,
undefined
,
undefined
> )
:
void
;
callback
Callback
<string, undefined, undefined>
void
getSession(request, options)
getSession
(
request
?:
protos
.
google
.
spanner
.
v1
.
IGetSessionRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
spanner
.
v1
.
ISession
,
protos
.
google
.
spanner
.
v1
.
IGetSessionRequest
|
undefined
,
{}
|
undefined
]>;
Gets a session. Returns NOT_FOUND
if the session does not exist. This is mainly useful for determining whether a session is still alive.
request
options
Promise
<[ protos.google.spanner.v1.ISession
, protos.google.spanner.v1.IGetSessionRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Session . Please see the documentation for more details and examples.
getSession(request, options, callback)
getSession
(
request
:
protos
.
google
.
spanner
.
v1
.
IGetSessionRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
ISession
,
protos
.
google
.
spanner
.
v1
.
IGetSessionRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.spanner.v1.ISession
, protos.google.spanner.v1.IGetSessionRequest
| null | undefined, {} | null | undefined>
void
getSession(request, callback)
getSession
(
request
:
protos
.
google
.
spanner
.
v1
.
IGetSessionRequest
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
ISession
,
protos
.
google
.
spanner
.
v1
.
IGetSessionRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.spanner.v1.ISession
, protos.google.spanner.v1.IGetSessionRequest
| null | undefined, {} | null | undefined>
void
initialize()
initialize
()
:
Promise
< {
[
name
:
string
]
:
Function
;
}>;
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Promise
<{
[name: string]: Function
;
}>
{Promise} A promise that resolves to an authenticated service stub.
listSessions(request, options)
listSessions
(
request
?:
protos
.
google
.
spanner
.
v1
.
IListSessionsRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
spanner
.
v1
.
ISession
[],
protos
.
google
.
spanner
.
v1
.
IListSessionsRequest
|
null
,
protos
.
google
.
spanner
.
v1
.
IListSessionsResponse
]>;
Lists all sessions in a given database.
request
options
Promise
<[ protos.google.spanner.v1.ISession
[], protos.google.spanner.v1.IListSessionsRequest
| null, protos.google.spanner.v1.IListSessionsResponse
]>
{Promise} - The promise which resolves to an array. The first element of the array is Array of Session
. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listSessionsAsync()
method described below for async iteration which you can stop as needed. Please see the documentation
for more details and examples.
listSessions(request, options, callback)
listSessions
(
request
:
protos
.
google
.
spanner
.
v1
.
IListSessionsRequest
,
options
:
CallOptions
,
callback
:
PaginationCallback<protos
.
google
.
spanner
.
v1
.
IListSessionsRequest
,
protos
.
google
.
spanner
.
v1
.
IListSessionsResponse
|
null
|
undefined
,
protos
.
google
.
spanner
.
v1
.
ISession
> )
:
void
;
request
options
CallOptions
callback
PaginationCallback
< protos.google.spanner.v1.IListSessionsRequest
, protos.google.spanner.v1.IListSessionsResponse
| null | undefined, protos.google.spanner.v1.ISession
>
void
listSessions(request, callback)
listSessions
(
request
:
protos
.
google
.
spanner
.
v1
.
IListSessionsRequest
,
callback
:
PaginationCallback<protos
.
google
.
spanner
.
v1
.
IListSessionsRequest
,
protos
.
google
.
spanner
.
v1
.
IListSessionsResponse
|
null
|
undefined
,
protos
.
google
.
spanner
.
v1
.
ISession
> )
:
void
;
request
callback
PaginationCallback
< protos.google.spanner.v1.IListSessionsRequest
, protos.google.spanner.v1.IListSessionsResponse
| null | undefined, protos.google.spanner.v1.ISession
>
void
listSessionsAsync(request, options)
listSessionsAsync
(
request
?:
protos
.
google
.
spanner
.
v1
.
IListSessionsRequest
,
options
?:
CallOptions
)
:
AsyncIterable<protos
.
google
.
spanner
.
v1
.
ISession
> ;
Equivalent to listSessions
, but returns an iterable object.
for
- await
- of
syntax is used with the iterable to get response elements on-demand.
request
options
AsyncIterable
< protos.google.spanner.v1.ISession
>
{Object} An iterable Object that allows async iteration . When you iterate the returned iterable, each element will be an object representing Session . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.
listSessionsStream(request, options)
listSessionsStream
(
request
?:
protos
.
google
.
spanner
.
v1
.
IListSessionsRequest
,
options
?:
CallOptions
)
:
Transform
;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
request
options
Transform
{Stream} An object stream which emits an object representing Session
on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listSessionsAsync()
method described below for async iteration which you can stop as needed. Please see the documentation
for more details and examples.
matchDatabaseFromDatabaseName(databaseName)
matchDatabaseFromDatabaseName
(
databaseName
:
string
)
:
string
|
number
;
Parse the database from Database resource.
databaseName
string
A fully-qualified path representing Database resource.
string | number
{string} A string representing the database.
matchDatabaseFromSessionName(sessionName)
matchDatabaseFromSessionName
(
sessionName
:
string
)
:
string
|
number
;
Parse the database from Session resource.
sessionName
string
A fully-qualified path representing Session resource.
string | number
{string} A string representing the database.
matchInstanceFromDatabaseName(databaseName)
matchInstanceFromDatabaseName
(
databaseName
:
string
)
:
string
|
number
;
Parse the instance from Database resource.
databaseName
string
A fully-qualified path representing Database resource.
string | number
{string} A string representing the instance.
matchInstanceFromSessionName(sessionName)
matchInstanceFromSessionName
(
sessionName
:
string
)
:
string
|
number
;
Parse the instance from Session resource.
sessionName
string
A fully-qualified path representing Session resource.
string | number
{string} A string representing the instance.
matchProjectFromDatabaseName(databaseName)
matchProjectFromDatabaseName
(
databaseName
:
string
)
:
string
|
number
;
Parse the project from Database resource.
databaseName
string
A fully-qualified path representing Database resource.
string | number
{string} A string representing the project.
matchProjectFromSessionName(sessionName)
matchProjectFromSessionName
(
sessionName
:
string
)
:
string
|
number
;
Parse the project from Session resource.
sessionName
string
A fully-qualified path representing Session resource.
string | number
{string} A string representing the project.
matchSessionFromSessionName(sessionName)
matchSessionFromSessionName
(
sessionName
:
string
)
:
string
|
number
;
Parse the session from Session resource.
sessionName
string
A fully-qualified path representing Session resource.
string | number
{string} A string representing the session.
partitionQuery(request, options)
partitionQuery
(
request
?:
protos
.
google
.
spanner
.
v1
.
IPartitionQueryRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
spanner
.
v1
.
IPartitionResponse
,
protos
.
google
.
spanner
.
v1
.
IPartitionQueryRequest
|
undefined
,
{}
|
undefined
]>;
Creates a set of partition tokens that can be used to execute a query operation in parallel. Each of the returned partition tokens can be used by to specify a subset of the query result to read. The same session and read-only transaction must be used by the PartitionQueryRequest used to create the partition tokens and the ExecuteSqlRequests that use the partition tokens.
Partition tokens become invalid when the session used to create them is deleted, is idle for too long, begins a new transaction, or becomes too old. When any of these happen, it is not possible to resume the query, and the whole operation must be restarted from the beginning.
request
options
Promise
<[ protos.google.spanner.v1.IPartitionResponse
, protos.google.spanner.v1.IPartitionQueryRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing PartitionResponse . Please see the documentation for more details and examples.
partitionQuery(request, options, callback)
partitionQuery
(
request
:
protos
.
google
.
spanner
.
v1
.
IPartitionQueryRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
IPartitionResponse
,
protos
.
google
.
spanner
.
v1
.
IPartitionQueryRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.spanner.v1.IPartitionResponse
, protos.google.spanner.v1.IPartitionQueryRequest
| null | undefined, {} | null | undefined>
void
partitionQuery(request, callback)
partitionQuery
(
request
:
protos
.
google
.
spanner
.
v1
.
IPartitionQueryRequest
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
IPartitionResponse
,
protos
.
google
.
spanner
.
v1
.
IPartitionQueryRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.spanner.v1.IPartitionResponse
, protos.google.spanner.v1.IPartitionQueryRequest
| null | undefined, {} | null | undefined>
void
partitionRead(request, options)
partitionRead
(
request
?:
protos
.
google
.
spanner
.
v1
.
IPartitionReadRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
spanner
.
v1
.
IPartitionResponse
,
protos
.
google
.
spanner
.
v1
.
IPartitionReadRequest
|
undefined
,
{}
|
undefined
]>;
Creates a set of partition tokens that can be used to execute a read operation in parallel. Each of the returned partition tokens can be used by to specify a subset of the read result to read. The same session and read-only transaction must be used by the PartitionReadRequest used to create the partition tokens and the ReadRequests that use the partition tokens. There are no ordering guarantees on rows returned among the returned partition tokens, or even within each individual StreamingRead call issued with a partition_token.
Partition tokens become invalid when the session used to create them is deleted, is idle for too long, begins a new transaction, or becomes too old. When any of these happen, it is not possible to resume the read, and the whole operation must be restarted from the beginning.
request
options
Promise
<[ protos.google.spanner.v1.IPartitionResponse
, protos.google.spanner.v1.IPartitionReadRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing PartitionResponse . Please see the documentation for more details and examples.
partitionRead(request, options, callback)
partitionRead
(
request
:
protos
.
google
.
spanner
.
v1
.
IPartitionReadRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
IPartitionResponse
,
protos
.
google
.
spanner
.
v1
.
IPartitionReadRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.spanner.v1.IPartitionResponse
, protos.google.spanner.v1.IPartitionReadRequest
| null | undefined, {} | null | undefined>
void
partitionRead(request, callback)
partitionRead
(
request
:
protos
.
google
.
spanner
.
v1
.
IPartitionReadRequest
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
IPartitionResponse
,
protos
.
google
.
spanner
.
v1
.
IPartitionReadRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.spanner.v1.IPartitionResponse
, protos.google.spanner.v1.IPartitionReadRequest
| null | undefined, {} | null | undefined>
void
read(request, options)
read
(
request
?:
protos
.
google
.
spanner
.
v1
.
IReadRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
spanner
.
v1
.
IResultSet
,
protos
.
google
.
spanner
.
v1
.
IReadRequest
|
undefined
,
{}
|
undefined
]>;
Reads rows from the database using key lookups and scans, as a simple key/value style alternative to . This method cannot be used to return a result set larger than 10 MiB; if the read matches more data than that, the read fails with a FAILED_PRECONDITION
error.
Reads inside read-write transactions might return ABORTED
. If this occurs, the application should restart the transaction from the beginning. See Transaction
for more details.
Larger result sets can be yielded in streaming fashion by calling instead.
request
options
Promise
<[ protos.google.spanner.v1.IResultSet
, protos.google.spanner.v1.IReadRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing ResultSet . Please see the documentation for more details and examples.
read(request, options, callback)
read
(
request
:
protos
.
google
.
spanner
.
v1
.
IReadRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
IResultSet
,
protos
.
google
.
spanner
.
v1
.
IReadRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.spanner.v1.IResultSet
, protos.google.spanner.v1.IReadRequest
| null | undefined, {} | null | undefined>
void
read(request, callback)
read
(
request
:
protos
.
google
.
spanner
.
v1
.
IReadRequest
,
callback
:
Callback<protos
.
google
.
spanner
.
v1
.
IResultSet
,
protos
.
google
.
spanner
.
v1
.
IReadRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.spanner.v1.IResultSet
, protos.google.spanner.v1.IReadRequest
| null | undefined, {} | null | undefined>
void
rollback(request, options)
rollback
(
request
?:
protos
.
google
.
spanner
.
v1
.
IRollbackRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
protobuf
.
IEmpty
,
protos
.
google
.
spanner
.
v1
.
IRollbackRequest
|
undefined
,
{}
|
undefined
]>;
Rolls back a transaction, releasing any locks it holds. It is a good idea to call this for any transaction that includes one or more or requests and ultimately decides not to commit.
Rollback
returns OK
if it successfully aborts the transaction, the transaction was already aborted, or the transaction is not found. Rollback
never returns ABORTED
.
request
options
Promise
<[ protos.google.protobuf.IEmpty
, protos.google.spanner.v1.IRollbackRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty . Please see the documentation for more details and examples.
rollback(request, options, callback)
rollback
(
request
:
protos
.
google
.
spanner
.
v1
.
IRollbackRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
protobuf
.
IEmpty
,
protos
.
google
.
spanner
.
v1
.
IRollbackRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.protobuf.IEmpty
, protos.google.spanner.v1.IRollbackRequest
| null | undefined, {} | null | undefined>
void
rollback(request, callback)
rollback
(
request
:
protos
.
google
.
spanner
.
v1
.
IRollbackRequest
,
callback
:
Callback<protos
.
google
.
protobuf
.
IEmpty
,
protos
.
google
.
spanner
.
v1
.
IRollbackRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.protobuf.IEmpty
, protos.google.spanner.v1.IRollbackRequest
| null | undefined, {} | null | undefined>
void
sessionPath(project, instance, database, session)
sessionPath
(
project
:
string
,
instance
:
string
,
database
:
string
,
session
:
string
)
:
string
;
Return a fully-qualified session resource name string.
project
string
instance
string
database
string
session
string
string
{string} Resource name string.
streamingRead(request, options)
streamingRead
(
request
?:
protos
.
google
.
spanner
.
v1
.
IReadRequest
,
options
?:
CallOptions
)
:
gax
.
CancellableStream
;
Like , except returns the result set as a stream. Unlike , there is no limit on the size of the returned result set. However, no individual row in the result set can exceed 100 MiB, and no column value can exceed 10 MiB.
request
options
gax.CancellableStream
{Stream} An object stream which emits PartialResultSet on 'data' event. Please see the documentation for more details and examples.