0
votes

Google has a series of APIs for interacting with Cloud Spanner. However, in all the examples that insert a record, none of them have a way of returning an Insert ID the way a lot of other database APIs would have.

Is there a way to get the InsertID of a record I just inserted into a Cloud Spanner table?

2

2 Answers

1
votes

No, this functionality is not available in Cloud Spanner for one very good reason: Cloud Spanner does not support any kind of automatically generated id's, such as sequences, identity columns or automatically generated UUID's. The primary key value of a row is always specified by the client, which means that there is no need for a function for returning the primary key value to client (as it is already known by the client).

0
votes

You can refer to the Spanner Doc:

Note: There is no auto-increment capability in Cloud Spanner.