Skip to main content

databases

Overview

Namedatabases
TypeResource
Idgoogle.spanner.databases

Fields

NameDatatypeDescription
namestringRequired. The name of the database. Values are of the form projects//instances//databases/, where `is as specified in theCREATE DATABASE` statement. This name can be passed to other API methods to identify the database.
createTimestringOutput only. If exists, the time at which the database creation started.
databaseDialectstringOutput only. The dialect of the Cloud Spanner Database.
defaultLeaderstringOutput only. The read-write region which contains the database's leader replicas. This is the same as the value of default_leader database option set using DatabaseAdmin.CreateDatabase or DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.
earliestVersionTimestringOutput only. Earliest timestamp at which older versions of the data can be read. This value is continuously updated by Cloud Spanner and becomes stale the moment it is queried. If you are using this value to recover data, make sure to account for the time from the moment when the value is queried to the moment when you initiate the recovery.
enableDropProtectionbooleanWhether drop protection is enabled for this database. Defaults to false, if not set. For more details, please see how to prevent accidental database deletion.
encryptionConfigobjectEncryption configuration for a Cloud Spanner database.
encryptionInfoarrayOutput only. For databases that are using customer managed encryption, this field contains the encryption information for the database, such as all Cloud KMS key versions that are in use. The encryption_status' field inside of each EncryptionInfo` is not populated. For databases that are using Google default or other types of encryption, this field is empty. This field is propagated lazily from the backend. There might be a delay from when a key version is being used and when it appears in this field.
reconcilingbooleanOutput only. If true, the database is being updated. If false, there are no ongoing update operations for the database.
restoreInfoobjectInformation about the database restore.
statestringOutput only. The current database state.
versionRetentionPeriodstringOutput only. The period in which Cloud Spanner retains all versions of data for the database. This is the same as the value of version_retention_period database option set using UpdateDatabaseDdl. Defaults to 1 hour, if not set.

Methods

NameAccessible byRequired ParamsDescription
projects_instances_databases_getSELECTdatabasesId, instancesId, projectsIdGets the state of a Cloud Spanner database.
projects_instances_databases_listSELECTinstancesId, projectsIdLists Cloud Spanner databases.
projects_instances_databases_createINSERTinstancesId, projectsIdCreates a new Cloud Spanner database and starts to prepare it for serving. The returned long-running operation will have a name of the format /operations/ and can be used to track preparation of the database. The metadata field type is CreateDatabaseMetadata. The response field type is Database, if successful.
_projects_instances_databases_listEXECinstancesId, projectsIdLists Cloud Spanner databases.
projects_instances_databases_drop_databaseEXECdatabasesId, instancesId, projectsIdDrops (aka deletes) a Cloud Spanner database. Completed backups for the database will be retained according to their expire_time. Note: Cloud Spanner might continue to accept requests for a few seconds after the database has been deleted.
projects_instances_databases_patchEXECdatabasesId, instancesId, projectsIdUpdates 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, returns NOT_FOUND. While the operation is pending: The database's reconciling field is set to true. Cancelling the operation is best-effort. If the cancellation succeeds, the operation metadata's cancel_time is set, the updates are reverted, and the operation terminates with a CANCELLED status. New UpdateDatabase requests will return a FAILED_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's reconciling field becomes false. The returned long-running operation will have a name of the format projects//instances//databases//operations/ and can be used to track the database modification. The metadata field type is UpdateDatabaseMetadata. The response field type is Database, if successful.
projects_instances_databases_restoreEXECinstancesId, projectsIdCreate a new database by restoring from a completed backup. The new database must be in the same project and in an instance with the same instance configuration as the instance containing the backup. The returned database long-running operation has a name of the format projects//instances//databases//operations/, and can be used to track the progress of the operation, and to cancel it. The metadata field type is RestoreDatabaseMetadata. The response type is Database, if successful. Cancelling the returned operation will stop the restore and delete the database. There can be only one database being restored into an instance at a time. Once the restore operation completes, a new restore operation can be initiated, without waiting for the optimize operation associated with the first restore to complete.