Method: projects.instances.databases.patch

Updates a Cloud Spanner database. The returned long-running operation can be used to track the progress of updating the database. If the named database does not exist, returnsNOT_FOUND.

While the operation is pending:

  • The database'sreconciling field is set to true.
  • Cancelling the operation is best-effort. If the cancellation succeeds, the operation metadata'scancelTime is set, the updates are reverted, and the operation terminates with aCANCELLED status.
  • New databases.patch requests will return aFAILED_PRECONDITION error until the pending operation is done (returns successfully or with error).
  • Reading the database via the API continues to give the pre-request values.

Upon completion of the returned operation:

  • The new values are in effect and readable via the API.
  • The database'sreconciling field becomes false.

The returned long-running operation will have a name of the formatprojects/<project>/instances/<instance>/databases/<database>/operations/<operationId> and can be used to track the database modification. The metadata field type isUpdateDatabaseMetadata. The response field type isDatabase, if successful.

HTTP request


PATCH https://spanner.googleapis.com/v1/{database.name=projects/*/instances/*/databases/*}

The URLs usegRPC Transcoding syntax.

Path parameters

Parameters
database.name

string

Required. The name of the database. Values are of the formprojects/<project>/instances/<instance>/databases/<database>, where<database> is as specified in theCREATE DATABASE statement. This name can be passed to other API methods to identify the database.

Query parameters

Parameters
updateMask

string (FieldMask format)

Required. The list of fields to update. Currently, onlyenableDropProtection field can be updated.

This is a comma-separated list of fully qualified names of fields. Example:"user.displayName,photo".

Request body

The request body contains an instance ofDatabase.

Response body

If successful, the response body contains an instance ofOperation.

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 theAuthentication Overview.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-12 UTC.