Skip to main content

databases

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

Overview

Namedatabases
TypeResource
Iddeno.database.databases

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstring (uuid)A KV database ID
createdAtstring (date-time) (example: 2021-08-01T00:00:00Z)
descriptionstringA description of this KV database
organizationIdstring (uuid)An organization ID that this KV database belongs to
updatedAtstring (date-time) (example: 2021-08-01T00:00:00Z)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_kv_databasesselectorganizationIdpage, limit, q, sort, orderThis API returns a list of KV databases belonging to the specified organization
in a pagenated manner.
The URLs for the next, previous, first, and last page are returned in the
Link header of the response, if any.
create_kv_databaseinsertorganizationIdThis API allows you to create a new KV database under the specified
organization. You will then be able to associate the created KV database
with a new deployment by specifying the KV database ID in the "Create a
deployment" API call.
update_kv_databaseupdatedatabaseId

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
databaseIdstring (uuid)KV database ID
organizationIdstring (uuid)Organization ID
limitintegerThe maximum number of items to return per page.
orderstringSort order, either asc or desc. Defaults to asc.
pageintegerThe page number to return.
qstringQuery by KV database ID
sortstringThe field to sort by. Currently only created_at is supported.

SELECT examples

This API returns a list of KV databases belonging to the specified organization
in a pagenated manner.
The URLs for the next, previous, first, and last page are returned in the
Link header of the response, if any.

SELECT
id,
createdAt,
description,
organizationId,
updatedAt
FROM deno.database.databases
WHERE organizationId = '{{ organizationId }}' -- required
AND page = '{{ page }}'
AND limit = '{{ limit }}'
AND q = '{{ q }}'
AND sort = '{{ sort }}'
AND order = '{{ order }}'
;

INSERT examples

This API allows you to create a new KV database under the specified
organization. You will then be able to associate the created KV database
with a new deployment by specifying the KV database ID in the "Create a
deployment" API call.

INSERT INTO deno.database.databases (
data__description,
organizationId
)
SELECT
'{{ description }}',
'{{ organizationId }}'
RETURNING
id,
createdAt,
description,
organizationId,
updatedAt
;

UPDATE examples

No description available.

UPDATE deno.database.databases
SET
data__description = '{{ description }}'
WHERE
databaseId = '{{ databaseId }}' --required
RETURNING
id,
createdAt,
description,
organizationId,
updatedAt;