Skip to main content

records

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

Overview

Namerecords
TypeResource
Idaws.sagemaker_featurestore_runtime.records

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
expires_atstringThe ExpiresAt ISO string of the requested record.
recordarrayThe record you requested. A list of FeatureValues.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_recordselectfeature_group_name, RecordIdentifierValueAsString, regionFeatureName, ExpirationTimeResponseUse for OnlineStore serving from a FeatureStore. Only the latest records stored in the OnlineStore can be retrieved. If no Record with RecordIdentifierValue is found, then an empty result is returned.
batch_get_recordselectregionRetrieves a batch of Records from a FeatureGroup.
list_recordsselectfeature_group_name, regionLists the RecordIdentifier values of all records stored in a FeatureGroup's OnlineStore. This enables you to discover which records exist without retrieving the full record data.
put_recordreplacefeature_group_name, regionThe PutRecord API is used to ingest a list of Records into your feature group. If a new record’s EventTime is greater, the new record is written to both the OnlineStore and OfflineStore. Otherwise, the record is a historic record and it is written only to the OfflineStore. You can specify the ingestion to be applied to the OnlineStore, OfflineStore, or both by using the TargetStores request parameter. You can set the ingested record to expire at a given time to live (TTL) duration after the record’s event time, ExpiresAt = EventTime + TtlDuration, by specifying the TtlDuration parameter. A record level TtlDuration is set when specifying the TtlDuration parameter using the PutRecord API call. If the input TtlDuration is null or unspecified, TtlDuration is set to the default feature group level TtlDuration. A record level TtlDuration supersedes the group level TtlDuration.
delete_recorddeletefeature_group_name, RecordIdentifierValueAsString, EventTime, regionTargetStores, DeletionModeDeletes a Record from a FeatureGroup in the OnlineStore. Feature Store supports both SoftDelete and HardDelete. For SoftDelete (default), feature columns are set to null and the record is no longer retrievable by GetRecord or BatchGetRecord. For HardDelete, the complete Record is removed from the OnlineStore. In both cases, Feature Store appends the deleted record marker to the OfflineStore. The deleted record marker is a record with the same RecordIdentifer as the original, but with is_deleted value set to True, EventTime set to the delete input EventTime, and other feature values set to null. Note that the EventTime specified in DeleteRecord should be set later than the EventTime of the existing record in the OnlineStore for that RecordIdentifer. If it is not, the deletion does not occur: For SoftDelete, the existing (not deleted) record remains in the OnlineStore, though the delete record marker is still written to the OfflineStore. HardDelete returns EventTime: 400 ValidationException to indicate that the delete operation failed. No delete record marker is written to the OfflineStore. When a record is deleted from the OnlineStore, the deleted record marker is appended to the OfflineStore. If you have the Iceberg table format enabled for your OfflineStore, you can remove all history of a record from the OfflineStore using Amazon Athena or Apache Spark. For information on how to hard delete a record from the OfflineStore with the Iceberg table format enabled, see Delete records from the offline store.

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
EventTimestringTimestamp indicating when the deletion event occurred. EventTime can be used to query data at a certain point in time.
RecordIdentifierValueAsStringstringThe value for the RecordIdentifier that uniquely identifies the record, in string format.
feature_group_namestringThe name or Amazon Resource Name (ARN) of the feature group to delete the record from.
regionstringAWS region (default: us-east-1)
DeletionModestringThe name of the deletion mode for deleting the record. By default, the deletion mode is set to SoftDelete.
ExpirationTimeResponsestringParameter to request ExpiresAt in response. If Enabled, GetRecord will return the value of ExpiresAt, if it is not null. If Disabled and null, GetRecord will return null.
FeatureNamearrayList of names of Features to be retrieved. If not specified, the latest value for all the Features are returned.
TargetStoresarrayA list of stores from which you're deleting the record. By default, Feature Store deletes the record from all of the stores that you're using for the FeatureGroup.

SELECT examples

Use for OnlineStore serving from a FeatureStore. Only the latest records stored in the OnlineStore can be retrieved. If no Record with RecordIdentifierValue is found, then an empty result is returned.

SELECT
expires_at,
record
FROM aws.sagemaker_featurestore_runtime.records
WHERE feature_group_name = '{{ feature_group_name }}' -- required
AND RecordIdentifierValueAsString = '{{ RecordIdentifierValueAsString }}' -- required
AND region = '{{ region }}' -- required
AND FeatureName = '{{ FeatureName }}'
AND ExpirationTimeResponse = '{{ ExpirationTimeResponse }}'
;

REPLACE examples

The PutRecord API is used to ingest a list of Records into your feature group. If a new record’s EventTime is greater, the new record is written to both the OnlineStore and OfflineStore. Otherwise, the record is a historic record and it is written only to the OfflineStore. You can specify the ingestion to be applied to the OnlineStore, OfflineStore, or both by using the TargetStores request parameter. You can set the ingested record to expire at a given time to live (TTL) duration after the record’s event time, ExpiresAt = EventTime + TtlDuration, by specifying the TtlDuration parameter. A record level TtlDuration is set when specifying the TtlDuration parameter using the PutRecord API call. If the input TtlDuration is null or unspecified, TtlDuration is set to the default feature group level TtlDuration. A record level TtlDuration supersedes the group level TtlDuration.

REPLACE aws.sagemaker_featurestore_runtime.records
SET
Record = '{{ Record }}',
TargetStores = '{{ TargetStores }}',
TtlDuration = '{{ TtlDuration }}'
WHERE
feature_group_name = '{{ feature_group_name }}' --required
AND region = '{{ region }}' --required;

DELETE examples

Deletes a Record from a FeatureGroup in the OnlineStore. Feature Store supports both SoftDelete and HardDelete. For SoftDelete (default), feature columns are set to null and the record is no longer retrievable by GetRecord or BatchGetRecord. For HardDelete, the complete Record is removed from the OnlineStore. In both cases, Feature Store appends the deleted record marker to the OfflineStore. The deleted record marker is a record with the same RecordIdentifer as the original, but with is_deleted value set to True, EventTime set to the delete input EventTime, and other feature values set to null. Note that the EventTime specified in DeleteRecord should be set later than the EventTime of the existing record in the OnlineStore for that RecordIdentifer. If it is not, the deletion does not occur: For SoftDelete, the existing (not deleted) record remains in the OnlineStore, though the delete record marker is still written to the OfflineStore. HardDelete returns EventTime: 400 ValidationException to indicate that the delete operation failed. No delete record marker is written to the OfflineStore. When a record is deleted from the OnlineStore, the deleted record marker is appended to the OfflineStore. If you have the Iceberg table format enabled for your OfflineStore, you can remove all history of a record from the OfflineStore using Amazon Athena or Apache Spark. For information on how to hard delete a record from the OfflineStore with the Iceberg table format enabled, see Delete records from the offline store.

DELETE FROM aws.sagemaker_featurestore_runtime.records
WHERE feature_group_name = '{{ feature_group_name }}' --required
AND RecordIdentifierValueAsString = '{{ RecordIdentifierValueAsString }}' --required
AND EventTime = '{{ EventTime }}' --required
AND region = '{{ region }}' --required
AND TargetStores = '{{ TargetStores }}'
AND DeletionMode = '{{ DeletionMode }}'
;