Skip to main content

datasets

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

Overview

Namedatasets
TypeResource
Idaws.cognito_sync.datasets

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
creation_datestring (date-time)Date on which the dataset was created.
data_storageinteger (int64)Total size in bytes of the records in this dataset.
dataset_namestringA string of up to 128 characters. Allowed characters are a-z, A-Z, 0-9, '' (underscore), '-' (dash), and '.' (dot). (pattern: <code>[a-zA-Z0-9.:-]+</code>)
identity_idstringA name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region. (pattern: <code>[\w-]+:[0-9a-f-]+</code>)
last_modified_bystringThe device that made the last change to this dataset.
last_modified_datestring (date-time)Date when the dataset was last modified.
num_recordsinteger (int64)Number of records in this dataset.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_datasetselectidentity_pool_id, identity_id, dataset_name, regionGets meta data about a dataset by identity and dataset name. With Amazon Cognito Sync, each identity has access only to its own data. Thus, the credentials used to make this API call need to have access to the identity data. This API can be called with temporary user credentials provided by Cognito Identity or with developer credentials. You should use Cognito Identity credentials to make this API call.
list_datasetsselectidentity_pool_id, identity_id, regionnextToken, maxResultsLists datasets for an identity. With Amazon Cognito Sync, each identity has access only to its own data. Thus, the credentials used to make this API call need to have access to the identity data. ListDatasets can be called with temporary user credentials provided by Cognito Identity or with developer credentials. You should use the Cognito Identity credentials to make this API call.
delete_datasetdeleteidentity_pool_id, identity_id, dataset_name, regionDeletes the specific dataset. The dataset will be deleted permanently, and the action can't be undone. Datasets that this dataset was merged with will no longer report the merge. Any subsequent operation on this dataset will result in a ResourceNotFoundException. This API can be called with temporary user credentials provided by Cognito Identity or with developer credentials.
subscribe_to_datasetexecidentity_pool_id, identity_id, dataset_name, device_id, regionSubscribes to receive notifications when a dataset is modified by another device. This API can only be called with temporary credentials provided by Cognito Identity. You cannot call this API with developer credentials.
unsubscribe_from_datasetexecidentity_pool_id, identity_id, dataset_name, device_id, regionUnsubscribes from receiving notifications when a dataset is modified by another device. This API can only be called with temporary credentials provided by Cognito Identity. You cannot call this API with developer credentials.

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_namestringThe name of the dataset from which to unsubcribe.
device_idstringThe unique ID generated for this device by Cognito.
identity_idstringUnique ID for this identity.
identity_pool_idstringA name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. The ID of the pool to which this identity belongs.
regionstringAWS region (default: us-east-1)
maxResultsintegerThe maximum number of results to be returned.
nextTokenstringA pagination token for obtaining the next page of results.

SELECT examples

Gets meta data about a dataset by identity and dataset name. With Amazon Cognito Sync, each identity has access only to its own data. Thus, the credentials used to make this API call need to have access to the identity data. This API can be called with temporary user credentials provided by Cognito Identity or with developer credentials. You should use Cognito Identity credentials to make this API call.

SELECT
creation_date,
data_storage,
dataset_name,
identity_id,
last_modified_by,
last_modified_date,
num_records
FROM aws.cognito_sync.datasets
WHERE identity_pool_id = '{{ identity_pool_id }}' -- required
AND identity_id = '{{ identity_id }}' -- required
AND dataset_name = '{{ dataset_name }}' -- required
AND region = '{{ region }}' -- required
;

DELETE examples

Deletes the specific dataset. The dataset will be deleted permanently, and the action can't be undone. Datasets that this dataset was merged with will no longer report the merge. Any subsequent operation on this dataset will result in a ResourceNotFoundException. This API can be called with temporary user credentials provided by Cognito Identity or with developer credentials.

DELETE FROM aws.cognito_sync.datasets
WHERE identity_pool_id = '{{ identity_pool_id }}' --required
AND identity_id = '{{ identity_id }}' --required
AND dataset_name = '{{ dataset_name }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Subscribes to receive notifications when a dataset is modified by another device. This API can only be called with temporary credentials provided by Cognito Identity. You cannot call this API with developer credentials.

EXEC aws.cognito_sync.datasets.subscribe_to_dataset
@identity_pool_id='{{ identity_pool_id }}' --required,
@identity_id='{{ identity_id }}' --required,
@dataset_name='{{ dataset_name }}' --required,
@device_id='{{ device_id }}' --required,
@region='{{ region }}' --required
;