databases
Creates, updates, deletes, gets or lists a databases
resource.
Overview
Name | databases |
Type | Resource |
Id | google.firestore.databases |
Fields
Name | Datatype | Description |
---|---|---|
name | string | The resource name of the Database. Format: projects/{project}/databases/{database} |
appEngineIntegrationMode | string | The App Engine integration mode to use for this database. |
cmekConfig | object | The CMEK (Customer Managed Encryption Key) configuration for a Firestore database. If not present, the database is secured by the default Google encryption key. |
concurrencyMode | string | The concurrency control mode to use for this database. |
createTime | string | Output only. The timestamp at which this database was created. Databases created before 2016 do not populate create_time. |
deleteProtectionState | string | State of delete protection for the database. |
deleteTime | string | Output only. The timestamp at which this database was deleted. Only set if the database has been deleted. |
earliestVersionTime | string | Output only. The earliest timestamp at which older versions of the data can be read from the database. See [version_retention_period] above; this field is populated with now - version_retention_period . This value is continuously updated, 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. |
etag | string | This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. |
keyPrefix | string | Output only. The key_prefix for this database. This key_prefix is used, in combination with the project ID ("~") to construct the application ID that is returned from the Cloud Datastore APIs in Google App Engine first generation runtimes. This value may be empty in which case the appid to use for URL-encoded keys is the project_id (eg: foo instead of v~foo). |
locationId | string | The location of the database. Available locations are listed at https://cloud.google.com/firestore/docs/locations. |
pointInTimeRecoveryEnablement | string | Whether to enable the PITR feature on this database. |
previousId | string | Output only. The database resource's prior database ID. This field is only populated for deleted databases. |
sourceInfo | object | Information about the provenance of this database. |
type | string | The type of the database. See https://cloud.google.com/datastore/docs/firestore-or-datastore for information about how to choose. |
uid | string | Output only. The system-generated UUID4 for this Database. |
updateTime | string | Output only. The timestamp at which this database was most recently updated. Note this only includes updates to the database resource and not data contained by the database. |
versionRetentionPeriod | string | Output only. The period during which past versions of data are retained in the database. Any read or query can specify a read_time within this window, and will read the state of the database at that time. If the PITR feature is enabled, the retention period is 7 days. Otherwise, the retention period is 1 hour. |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
get | SELECT | databasesId, projectsId | Gets information about a database. |
list | SELECT | projectsId | List all the databases in the project. |
create | INSERT | projectsId | Create a database. |
bulk_delete_documents | DELETE | databasesId, projectsId | Bulk deletes a subset of documents from Google Cloud Firestore. Documents created or updated after the underlying system starts to process the request will not be deleted. The bulk delete occurs in the background and its progress can be monitored and managed via the Operation resource that is created. For more details on bulk delete behavior, refer to: https://cloud.google.com/firestore/docs/manage-data/bulk-delete |
delete | DELETE | databasesId, projectsId | Deletes a database. |
patch | UPDATE | databasesId, projectsId | Updates a database. |
export_documents | EXEC | databasesId, projectsId | Exports a copy of all or a subset of documents from Google Cloud Firestore to another storage system, such as Google Cloud Storage. Recent updates to documents may not be reflected in the export. The export occurs in the background and its progress can be monitored and managed via the Operation resource that is created. The output of an export may only be used once the associated operation is done. If an export operation is cancelled before completion it may leave partial data behind in Google Cloud Storage. For more details on export behavior and output format, refer to: https://cloud.google.com/firestore/docs/manage-data/export-import |
import_documents | EXEC | databasesId, projectsId | Imports documents into Google Cloud Firestore. Existing documents with the same name are overwritten. The import occurs in the background and its progress can be monitored and managed via the Operation resource that is created. If an ImportDocuments operation is cancelled, it is possible that a subset of the data has already been imported to Cloud Firestore. |
restore | EXEC | projectsId | Creates a new database by restoring from an existing backup. The new database must be in the same cloud region or multi-region location as the existing backup. This behaves similar to FirestoreAdmin.CreateDatabase except instead of creating a new empty database, a new database is created with the database type, index configuration, and documents from an existing backup. The long-running operation can be used to track the progress of the restore, with the Operation's metadata field type being the RestoreDatabaseMetadata. The response type is the Database if the restore was successful. The new database is not readable or writeable until the LRO has completed. |
SELECT
examples
List all the databases in the project.
SELECT
name,
appEngineIntegrationMode,
cmekConfig,
concurrencyMode,
createTime,
deleteProtectionState,
deleteTime,
earliestVersionTime,
etag,
keyPrefix,
locationId,
pointInTimeRecoveryEnablement,
previousId,
sourceInfo,
type,
uid,
updateTime,
versionRetentionPeriod
FROM google.firestore.databases
WHERE projectsId = '{{ projectsId }}';
INSERT
example
Use the following StackQL query and manifest file to create a new databases
resource.
- All Properties
- Manifest
/*+ create */
INSERT INTO google.firestore.databases (
projectsId,
name,
locationId,
type,
concurrencyMode,
pointInTimeRecoveryEnablement,
appEngineIntegrationMode,
deleteProtectionState,
cmekConfig,
etag
)
SELECT
'{{ projectsId }}',
'{{ name }}',
'{{ locationId }}',
'{{ type }}',
'{{ concurrencyMode }}',
'{{ pointInTimeRecoveryEnablement }}',
'{{ appEngineIntegrationMode }}',
'{{ deleteProtectionState }}',
'{{ cmekConfig }}',
'{{ etag }}'
;
- name: your_resource_model_name
props:
- name: name
value: string
- name: uid
value: string
- name: createTime
value: string
- name: updateTime
value: string
- name: deleteTime
value: string
- name: locationId
value: string
- name: type
value: string
- name: concurrencyMode
value: string
- name: versionRetentionPeriod
value: string
- name: earliestVersionTime
value: string
- name: pointInTimeRecoveryEnablement
value: string
- name: appEngineIntegrationMode
value: string
- name: keyPrefix
value: string
- name: deleteProtectionState
value: string
- name: cmekConfig
value:
- name: kmsKeyName
value: string
- name: activeKeyVersion
value:
- string
- name: previousId
value: string
- name: sourceInfo
value:
- name: backup
value:
- name: backup
value: string
- name: operation
value: string
- name: etag
value: string
UPDATE
example
Updates a databases
resource.
/*+ update */
UPDATE google.firestore.databases
SET
name = '{{ name }}',
locationId = '{{ locationId }}',
type = '{{ type }}',
concurrencyMode = '{{ concurrencyMode }}',
pointInTimeRecoveryEnablement = '{{ pointInTimeRecoveryEnablement }}',
appEngineIntegrationMode = '{{ appEngineIntegrationMode }}',
deleteProtectionState = '{{ deleteProtectionState }}',
cmekConfig = '{{ cmekConfig }}',
etag = '{{ etag }}'
WHERE
databasesId = '{{ databasesId }}'
AND projectsId = '{{ projectsId }}';
DELETE
example
Deletes the specified databases
resource.
/*+ delete */
DELETE FROM google.firestore.databases
WHERE databasesId = '{{ databasesId }}'
AND projectsId = '{{ projectsId }}';