Skip to content

update_record async

update_record(
    feature_group_name: FeatureGroupNameOrArn,
    *,
    config_overrides: Optional[AsyncSageMakerFeatureStoreRuntimeClientConfig] = None,
    record_identifier_value_as_string: Optional[ValueAsString] = None,
    features: Optional[Record] = None,
    target_stores: Optional[TargetStores] = None,
    ttl_duration: Optional[TtlDuration] = None,
) -> None

Updates one or more feature values for an existing record in the specified feature group. Features that you do not include in the request remain unchanged. You can update up to 100 features per call.

This operation is available only for feature groups that use the Standard_V2 or InMemory online store type.

The record must already exist. If the record does not exist or has been soft-deleted, the operation returns a ResourceNotFound error. To create a record, use PutRecord.

If you provide an EventTime that is older than the record's current EventTime, the service rejects the update with a ConflictException. If the EventTime is equal to or newer than the current value, the service applies the update. If you omit EventTime, the service keeps the record's existing EventTime and applies the update.

If you specify a TtlDuration, you must also provide an EventTime in the request. Otherwise, the operation returns a ValidationError.

Parameters:

  • feature_group_name (FeatureGroupNameOrArn) –

    The identifier for the feature group that contains the record to update. You can specify one of the following:

    • The feature group name.

    • The feature group Amazon Resource Name (ARN).

  • record_identifier_value_as_string (Optional[ValueAsString], default: None ) –

    The value that uniquely identifies the record in the feature group. This must match the value defined by the feature group's record identifier feature.

  • features (Optional[Record], default: None ) –

    The feature values to write to the record.

  • target_stores (Optional[TargetStores], default: None ) –

    The target stores for the record update. By default, Amazon SageMaker Feature Store updates the record in all stores associated with the FeatureGroup.

  • ttl_duration (Optional[TtlDuration], default: None ) –

    The time-to-live (TTL) duration for the record. Amazon SageMaker Feature Store deletes the record when EventTime + TtlDuration elapses. If you omit this parameter, the record's existing TTL setting remains unchanged. For information about HardDelete, see the DeleteRecord operation in the Amazon SageMaker API Reference.

Raises:

  • AccessForbidden –

    You do not have permission to perform an action.

  • ConflictException –

    The service rejected the update because the provided EventTime is older than the record's current EventTime. To persist the update, retrieve the record's latest EventTime and resubmit the request with an EventTime that is equal to or newer than the current value.

  • InternalFailure –

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

  • ResourceNotFound –

    A resource that is required to perform an action was not found.

  • 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.

Examples:

Update specific features in a record

>>> await client.update_record(feature_group_name='my-feature-group', record_identifier_value_as_string='cust-001', features=[{'FeatureName': 'age', 'ValueAsString': '26'}, {'FeatureName': 'membership_tier', 'ValueAsString': 'gold'}, {'FeatureName': 'event_time', 'ValueAsString': '2026-07-26T12:00:00Z'}])
Update features and set a time-to-live (TTL) duration
>>> await client.update_record(feature_group_name='my-feature-group', record_identifier_value_as_string='cust-001', features=[{'FeatureName': 'age', 'ValueAsString': '26'}, {'FeatureName': 'event_time', 'ValueAsString': '2026-07-26T12:00:00Z'}], ttl_duration={'Unit': 'Weeks', 'Value': 4})
Source code in docs_src/capo_sagemaker_featurestore_runtime/_services/async_sage_maker_feature_store_runtime.py
async def update_record(
    self,
    feature_group_name: "capo_sagemaker_featurestore_runtime.types.feature_group_name_or_arn.FeatureGroupNameOrArn",
    *,
    config_overrides: Optional[
        AsyncSageMakerFeatureStoreRuntimeClientConfig
    ] = None,
    record_identifier_value_as_string: Optional[
        "capo_sagemaker_featurestore_runtime.types.value_as_string.ValueAsString"
    ] = None,
    features: 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>Updates one or more feature values for an existing record in the specified feature group. Features that you do not include in the request remain unchanged. You can update up to 100 features per call.</p> <important> <p>This operation is available only for feature groups that use the <code>Standard_V2</code> or <code>InMemory</code> online store type.</p> </important> <p>The record must already exist. If the record does not exist or has been soft-deleted, the operation returns a <code>ResourceNotFound</code> error. To create a record, use <code>PutRecord</code>.</p> <p>If you provide an <code>EventTime</code> that is older than the record's current <code>EventTime</code>, the service rejects the update with a <code>ConflictException</code>. If the <code>EventTime</code> is equal to or newer than the current value, the service applies the update. If you omit <code>EventTime</code>, the service keeps the record's existing <code>EventTime</code> and applies the update.</p> <p>If you specify a <code>TtlDuration</code>, you must also provide an <code>EventTime</code> in the request. Otherwise, the operation returns a <code>ValidationError</code>.</p>

    Args:
        feature_group_name: <p>The identifier for the feature group that contains the record to update. You can specify one of the following:</p> <ul> <li> <p>The feature group name.</p> </li> <li> <p>The feature group Amazon Resource Name (ARN).</p> </li> </ul>
        record_identifier_value_as_string: <p>The value that uniquely identifies the record in the feature group. This must match the value defined by the feature group's record identifier feature.</p>
        features: <p>The feature values to write to the record.</p>
        target_stores: <p>The target stores for the record update. By default, Amazon SageMaker Feature Store updates the record in all stores associated with the <code>FeatureGroup</code>.</p>
        ttl_duration: <p>The time-to-live (TTL) duration for the record. Amazon SageMaker Feature Store deletes the record when <code>EventTime</code> + <code>TtlDuration</code> elapses. If you omit this parameter, the record's existing TTL setting remains unchanged. For information about <code>HardDelete</code>, see the <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_feature_store_DeleteRecord.html">DeleteRecord</a> operation in the Amazon SageMaker API Reference.</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.conflict_exception.ConflictException: <p>The service rejected the update because the provided <code>EventTime</code> is older than the record's current <code>EventTime</code>. To persist the update, retrieve the record's latest <code>EventTime</code> and resubmit the request with an <code>EventTime</code> that is equal to or newer than the current value.</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.resource_not_found.ResourceNotFound: <p>A resource that is required to perform an action was not found.</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.

    Examples:
        Update specific features in a record

        >>> await client.update_record(feature_group_name='my-feature-group', record_identifier_value_as_string='cust-001', features=[{'FeatureName': 'age', 'ValueAsString': '26'}, {'FeatureName': 'membership_tier', 'ValueAsString': 'gold'}, {'FeatureName': 'event_time', 'ValueAsString': '2026-07-26T12:00:00Z'}])
        Update features and set a time-to-live (TTL) duration

        >>> await client.update_record(feature_group_name='my-feature-group', record_identifier_value_as_string='cust-001', features=[{'FeatureName': 'age', 'ValueAsString': '26'}, {'FeatureName': 'event_time', 'ValueAsString': '2026-07-26T12:00:00Z'}], ttl_duration={'Unit': 'Weeks', 'Value': 4})
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker_featurestore_runtime.types.update_record_request.UpdateRecordRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_sagemaker_featurestore_runtime._operations.amazon_sage_maker_feature_store_runtime.update_record

        (
            output,
            http_response,
        ) = await capo_sagemaker_featurestore_runtime._operations.amazon_sage_maker_feature_store_runtime.update_record.async_update_record(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateRecord")
    )
    input_: capo_sagemaker_featurestore_runtime.types.update_record_request.UpdateRecordRequest = {
        "feature_group_name": feature_group_name
    }
    if record_identifier_value_as_string is not None:
        input_["record_identifier_value_as_string"] = (
            record_identifier_value_as_string
        )
    if features is not None:
        input_["features"] = features
    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