Updates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns, indexes, etc. The returned long-running operation will have a name of the format <database_name>/operations/<operationId>
and can be used to track execution of the schema changes. The metadata field type is UpdateDatabaseDdlMetadata
. The operation has no response.
HTTP request
PATCH https://spanner.googleapis.com/v1/{database=projects/*/instances/*/databases/*}/ddl
The URLs use gRPC Transcoding syntax.
Path parameters
database
string
Required. The database to update.
Authorization requires the following IAM
permission on the specified resource database
:
-
spanner.databases.updateDdl
Request body
The request body contains data with the following structure:
| JSON representation |
|---|
{ "statements" : [ string ] , "operationId" : string , "protoDescriptors" : string } |
| Fields | |
|---|---|
statements[]
|
Required. DDL statements to be applied to the database. |
operationId
|
If empty, the new update request is assigned an automatically-generated operation ID. Otherwise, Specifying an explicit operation ID simplifies determining whether the statements were executed in the event that the |
protoDescriptors
|
Optional. Proto descriptors used by CREATE/ALTER PROTO BUNDLE statements. Contains a protobuf-serialized google.protobuf.FileDescriptorSet
. To generate it, install
and run
For more details, see protobuffer self description . A base64-encoded string. |
Response body
If successful, the response body contains an instance of Operation
.
Authorization scopes
Requires one of the following OAuth scopes:
-
https://www.googleapis.com/auth/spanner.admin -
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview .

