PutRecord - Amazon SageMaker

PutRecord

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.

Request Syntax

PUT /FeatureGroup/FeatureGroupName HTTP/1.1 Content-type: application/json { "Record": [ { "FeatureName": "string", "ValueAsString": "string", "ValueAsStringList": [ "string" ] } ], "TargetStores": [ "string" ], "TtlDuration": { "Unit": "string", "Value": number } }

URI Request Parameters

The request uses the following URI parameters.

FeatureGroupName

The name or Amazon Resource Name (ARN) of the feature group that you want to insert the record into.

Length Constraints: Minimum length of 1. Maximum length of 150.

Pattern: (arn:aws[a-z\-]*:sagemaker:[a-z0-9\-]*:[0-9]{12}:feature-group/)?([a-zA-Z0-9]([-_]*[a-zA-Z0-9]){0,63})

Required: Yes

Request Body

The request accepts the following data in JSON format.

Record

List of FeatureValues to be inserted. This will be a full over-write. If you only want to update few of the feature values, do the following:

  • Use GetRecord to retrieve the latest record.

  • Update the record returned from GetRecord.

  • Use PutRecord to update feature values.

Type: Array of FeatureValue objects

Array Members: Minimum number of 1 item.

Required: Yes

TargetStores

A list of stores to which you're adding the record. By default, Feature Store adds the record to all of the stores that you're using for the FeatureGroup.

Type: Array of strings

Array Members: Minimum number of 1 item. Maximum number of 2 items.

Valid Values: OnlineStore | OfflineStore

Required: No

TtlDuration

Time to live duration, where the record is hard deleted after the expiration time is reached; ExpiresAt = EventTime + TtlDuration. For information on HardDelete, see the DeleteRecord API in the Amazon SageMaker API Reference guide.

Type: TtlDuration object

Required: No

Response Syntax

HTTP/1.1 200

Response Elements

If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

Errors

For information about the errors that are common to all actions, see Common Errors.

AccessForbidden

You do not have permission to perform an action.

HTTP Status Code: 403

InternalFailure

An internal failure occurred. Try your request again. If the problem persists, contact AWS customer support.

HTTP Status Code: 500

ServiceUnavailable

The service is currently unavailable.

HTTP Status Code: 503

ValidationError

There was an error validating your request.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: