Skip to main content

datasets

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

Overview

Namedatasets
TypeResource
Iddatadog.metrics.datasets

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringUnique identifier for the dataset. (example: 123e4567-e89b-12d3-a456-426614174000)
attributesobjectDataset metadata and configuration(s).
typestringResource type, always set to dataset. (dataset) (default: dataset, example: dataset)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_datasetselectdataset_idRetrieves the dataset associated with the ID.
get_all_datasetsselectGet all datasets that have been configured for an organization.
create_datasetinsertdataCreate a dataset with the configurations in the request.
update_datasetreplacedataset_id, dataEdits the dataset associated with the ID.
delete_datasetdeletedataset_idDeletes the dataset associated with the ID.

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
dataset_idstringThe ID of a defined dataset. (example: 0879ce27-29a1-481f-a12e-bc2a48ec9ae1)
sitestringThe Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both.

SELECT examples

Retrieves the dataset associated with the ID.

SELECT
id,
attributes,
type
FROM datadog.metrics.datasets
WHERE dataset_id = '{{ dataset_id }}' -- required
;

INSERT examples

Create a dataset with the configurations in the request.

INSERT INTO datadog.metrics.datasets (
data
)
SELECT
'{{ data }}' /* required */
RETURNING
data
;

REPLACE examples

Edits the dataset associated with the ID.

REPLACE datadog.metrics.datasets
SET
data = '{{ data }}'
WHERE
dataset_id = '{{ dataset_id }}' --required
AND data = '{{ data }}' --required
RETURNING
data;

DELETE examples

Deletes the dataset associated with the ID.

DELETE FROM datadog.metrics.datasets
WHERE dataset_id = '{{ dataset_id }}' --required
;