Skip to main content

databases

Creates, updates, deletes, gets or lists a databases resource.

Overview

Namedatabases
TypeResource
Idgoogle.biglake.databases

Fields

NameDatatypeDescription
namestringOutput only. The resource name. Format: projects/{project_id_or_number}/locations/{location_id}/catalogs/{catalog_id}/databases/{database_id}
createTimestringOutput only. The creation time of the database.
deleteTimestringOutput only. The deletion time of the database. Only set after the database is deleted.
expireTimestringOutput only. The time when this database is considered expired. Only set after the database is deleted.
hiveOptionsobjectOptions of a Hive database.
typestringThe database type.
updateTimestringOutput only. The last modification time of the database.

Methods

NameAccessible byRequired ParamsDescription
getSELECTcatalogsId, databasesId, locationsId, projectsIdGets the database specified by the resource name.
listSELECTcatalogsId, locationsId, projectsIdList all databases in a specified catalog.
createINSERTcatalogsId, locationsId, projectsIdCreates a new database.
deleteDELETEcatalogsId, databasesId, locationsId, projectsIdDeletes an existing database specified by the database ID.
patchUPDATEcatalogsId, databasesId, locationsId, projectsIdUpdates an existing database specified by the database ID.

SELECT examples

List all databases in a specified catalog.

SELECT
name,
createTime,
deleteTime,
expireTime,
hiveOptions,
type,
updateTime
FROM google.biglake.databases
WHERE catalogsId = '{{ catalogsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new databases resource.

/*+ create */
INSERT INTO google.biglake.databases (
catalogsId,
locationsId,
projectsId,
hiveOptions,
type
)
SELECT
'{{ catalogsId }}',
'{{ locationsId }}',
'{{ projectsId }}',
'{{ hiveOptions }}',
'{{ type }}'
;

UPDATE example

Updates a databases resource.

/*+ update */
UPDATE google.biglake.databases
SET
hiveOptions = '{{ hiveOptions }}',
type = '{{ type }}'
WHERE
catalogsId = '{{ catalogsId }}'
AND databasesId = '{{ databasesId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

DELETE example

Deletes the specified databases resource.

/*+ delete */
DELETE FROM google.biglake.databases
WHERE catalogsId = '{{ catalogsId }}'
AND databasesId = '{{ databasesId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';