databases
Creates, updates, deletes, gets or lists a databases resource.
Overview
| Name | databases |
| Type | Resource |
| Id | deno.database.databases |
Fields
The following fields are returned by SELECT queries:
- list_kv_databases
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | A KV database ID |
createdAt | string (date-time) | (example: 2021-08-01T00:00:00Z) |
description | string | A description of this KV database |
organizationId | string (uuid) | An organization ID that this KV database belongs to |
updatedAt | string (date-time) | (example: 2021-08-01T00:00:00Z) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_kv_databases | select | organizationId | page, limit, q, sort, order | 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. |
create_kv_database | insert | organizationId | 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. | |
update_kv_database | update | databaseId |
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.
| Name | Datatype | Description |
|---|---|---|
databaseId | string (uuid) | KV database ID |
organizationId | string (uuid) | Organization ID |
limit | integer | The maximum number of items to return per page. |
order | string | Sort order, either asc or desc. Defaults to asc. |
page | integer | The page number to return. |
q | string | Query by KV database ID |
sort | string | The field to sort by. Currently only created_at is supported. |
SELECT examples
- list_kv_databases
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 theLink 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
- create_kv_database
- Manifest
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
;
# Description fields are for documentation purposes
- name: databases
props:
- name: organizationId
value: string (uuid)
description: Required parameter for the databases resource.
- name: description
value: string
description: |
The description of the KV database. If this is `null`, an empty string
will be set.
UPDATE examples
- update_kv_database
No description available.
UPDATE deno.database.databases
SET
data__description = '{{ description }}'
WHERE
databaseId = '{{ databaseId }}' --required
RETURNING
id,
createdAt,
description,
organizationId,
updatedAt;