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.
Parameters:
-
feature_group_name
(FeatureGroupNameOrArn)
–
The name or Amazon Resource Name (ARN) of the feature group that you want to insert the record into.
-
record
(Optional[Record], default:
None
)
–
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.
-
target_stores
(Optional[TargetStores], default:
None
)
–
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.
-
ttl_duration
(Optional[TtlDuration], default:
None
)
–
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.
Raises:
-
AccessForbidden
–
You do not have permission to perform an action.
-
InternalFailure
–
An internal failure occurred. Try your request again. If the problem persists, contact Amazon Web Services customer support.
-
ServiceUnavailable
–
The service is currently unavailable.
-
ValidationError
–
There was an error validating your request.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_sagemaker_featurestore_runtime/_services/async_sage_maker_feature_store_runtime.py
| async def put_record(
self,
feature_group_name: "capo_sagemaker_featurestore_runtime.types.feature_group_name_or_arn.FeatureGroupNameOrArn",
*,
config_overrides: Optional[
AsyncSageMakerFeatureStoreRuntimeClientConfig
] = None,
record: Optional[
"capo_sagemaker_featurestore_runtime.types.record.Record"
] = None,
target_stores: Optional[
"capo_sagemaker_featurestore_runtime.types.target_stores.TargetStores"
] = None,
ttl_duration: Optional[
"capo_sagemaker_featurestore_runtime.types.ttl_duration.TtlDuration"
] = None,
) -> None:
"""<p>The <code>PutRecord</code> API is used to ingest a list of <code>Records</code> into your feature group. </p> <p>If a new record’s <code>EventTime</code> is greater, the new record is written to both the <code>OnlineStore</code> and <code>OfflineStore</code>. Otherwise, the record is a historic record and it is written only to the <code>OfflineStore</code>. </p> <p>You can specify the ingestion to be applied to the <code>OnlineStore</code>, <code>OfflineStore</code>, or both by using the <code>TargetStores</code> request parameter. </p> <p>You can set the ingested record to expire at a given time to live (TTL) duration after the record’s event time, <code>ExpiresAt</code> = <code>EventTime</code> + <code>TtlDuration</code>, by specifying the <code>TtlDuration</code> parameter. A record level <code>TtlDuration</code> is set when specifying the <code>TtlDuration</code> parameter using the <code>PutRecord</code> API call. If the input <code>TtlDuration</code> is <code>null</code> or unspecified, <code>TtlDuration</code> is set to the default feature group level <code>TtlDuration</code>. A record level <code>TtlDuration</code> supersedes the group level <code>TtlDuration</code>.</p>
Args:
feature_group_name: <p>The name or Amazon Resource Name (ARN) of the feature group that you want to insert the record into.</p>
record: <p>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:</p> <ul> <li> <p>Use <code>GetRecord</code> to retrieve the latest record.</p> </li> <li> <p>Update the record returned from <code>GetRecord</code>. </p> </li> <li> <p>Use <code>PutRecord</code> to update feature values.</p> </li> </ul>
target_stores: <p>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 <code>FeatureGroup</code>.</p>
ttl_duration: <p>Time to live duration, where the record is hard deleted after the expiration time is reached; <code>ExpiresAt</code> = <code>EventTime</code> + <code>TtlDuration</code>. For information on HardDelete, see the <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_feature_store_DeleteRecord.html">DeleteRecord</a> API in the Amazon SageMaker API Reference guide.</p>
Raises:
capo_sagemaker_featurestore_runtime.errors.access_forbidden.AccessForbidden: <p>You do not have permission to perform an action.</p>
capo_sagemaker_featurestore_runtime.errors.internal_failure.InternalFailure: <p>An internal failure occurred. Try your request again. If the problem persists, contact Amazon Web Services customer support.</p>
capo_sagemaker_featurestore_runtime.errors.service_unavailable.ServiceUnavailable: <p>The service is currently unavailable.</p>
capo_sagemaker_featurestore_runtime.errors.validation_error.ValidationError: <p>There was an error validating your request.</p>
capo_sagemaker_featurestore_runtime.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_sagemaker_featurestore_runtime.types.put_record_request.PutRecordRequest]",
) -> AsyncOperationResponse[None]:
import capo_sagemaker_featurestore_runtime._operations.amazon_sage_maker_feature_store_runtime.put_record
(
output,
http_response,
) = await capo_sagemaker_featurestore_runtime._operations.amazon_sage_maker_feature_store_runtime.put_record.async_put_record(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PutRecord")
)
input_: capo_sagemaker_featurestore_runtime.types.put_record_request.PutRecordRequest = {
"feature_group_name": feature_group_name
}
if record is not None:
input_["record"] = record
if target_stores is not None:
input_["target_stores"] = target_stores
if ttl_duration is not None:
input_["ttl_duration"] = ttl_duration
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|