SageMakerFeatureStoreRuntime / Client / batch_write_record

batch_write_record

SageMakerFeatureStoreRuntime.Client.batch_write_record(**kwargs)

Writes a batch of Records to one or more FeatureGroup``s. Use this API for bulk ingestion of records into the ``OnlineStore and OfflineStore.

You can set the ingested records to expire at a given time to live (TTL) duration after the record’s event time by specifying the TtlDuration parameter. A request level TtlDuration applies to all entries that do not specify their own TtlDuration.

See also: AWS API Documentation

Request Syntax

response = client.batch_write_record(
    Entries=[
        {
            'FeatureGroupName': 'string',
            'Record': [
                {
                    'FeatureName': 'string',
                    'ValueAsString': 'string',
                    'ValueAsStringList': [
                        'string',
                    ]
                },
            ],
            'TargetStores': [
                'OnlineStore'|'OfflineStore',
            ],
            'TtlDuration': {
                'Unit': 'Seconds'|'Minutes'|'Hours'|'Days'|'Weeks',
                'Value': 123
            }
        },
    ],
    TtlDuration={
        'Unit': 'Seconds'|'Minutes'|'Hours'|'Days'|'Weeks',
        'Value': 123
    }
)
Parameters:
  • Entries (list) –

    [REQUIRED]

    A list of records to write. Each entry specifies the FeatureGroup, the record data, and optionally target stores and a TTL duration.

    • (dict) –

      An entry to write as part of a BatchWriteRecord request.

      • FeatureGroupName (string) – [REQUIRED]

        The name or Amazon Resource Name (ARN) of the FeatureGroup to write the record to.

      • Record (list) – [REQUIRED]

        List of FeatureValues to be inserted. This will be a full over-write.

        • (dict) –

          The value associated with a feature.

          • FeatureName (string) – [REQUIRED]

            The name of a feature that a feature value corresponds to.

          • ValueAsString (string) –

            The value in string format associated with a feature. Used when your CollectionType is None. Note that features types can be String, Integral, or Fractional. This value represents all three types as a string.

          • ValueAsStringList (list) –

            The list of values in string format associated with a feature. Used when your CollectionType is a List, Set, or Vector. Note that features types can be String, Integral, or Fractional. These values represents all three types as a string.

            • (string) –

      • TargetStores (list) –

        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.

        • (string) –

      • TtlDuration (dict) –

        Time to live duration for this entry, where the record is hard deleted after the expiration time is reached; ExpiresAt = EventTime + TtlDuration. This overrides the request level TtlDuration.

        • Unit (string) – [REQUIRED]

          TtlDuration time unit.

        • Value (integer) – [REQUIRED]

          TtlDuration time value.

  • TtlDuration (dict) –

    Time to live duration applied to all entries in the batch that do not specify their own TtlDuration; ExpiresAt = EventTime + TtlDuration. For information on HardDelete, see the DeleteRecord API in the Amazon SageMaker API Reference guide.

    • Unit (string) – [REQUIRED]

      TtlDuration time unit.

    • Value (integer) – [REQUIRED]

      TtlDuration time value.

Return type:

dict

Returns:

Response Syntax

{
    'Errors': [
        {
            'Entry': {
                'FeatureGroupName': 'string',
                'Record': [
                    {
                        'FeatureName': 'string',
                        'ValueAsString': 'string',
                        'ValueAsStringList': [
                            'string',
                        ]
                    },
                ],
                'TargetStores': [
                    'OnlineStore'|'OfflineStore',
                ],
                'TtlDuration': {
                    'Unit': 'Seconds'|'Minutes'|'Hours'|'Days'|'Weeks',
                    'Value': 123
                }
            },
            'ErrorCode': 'string',
            'ErrorMessage': 'string'
        },
    ],
    'UnprocessedEntries': [
        {
            'FeatureGroupName': 'string',
            'Record': [
                {
                    'FeatureName': 'string',
                    'ValueAsString': 'string',
                    'ValueAsStringList': [
                        'string',
                    ]
                },
            ],
            'TargetStores': [
                'OnlineStore'|'OfflineStore',
            ],
            'TtlDuration': {
                'Unit': 'Seconds'|'Minutes'|'Hours'|'Days'|'Weeks',
                'Value': 123
            }
        },
    ]
}

Response Structure

  • (dict) –

    • Errors (list) –

      A list of errors that occurred when writing records in the batch.

      • (dict) –

        The error that has occurred when attempting to write a record in a batch.

        • Entry (dict) –

          The entry that failed to be written.

          • FeatureGroupName (string) –

            The name or Amazon Resource Name (ARN) of the FeatureGroup to write the record to.

          • Record (list) –

            List of FeatureValues to be inserted. This will be a full over-write.

            • (dict) –

              The value associated with a feature.

              • FeatureName (string) –

                The name of a feature that a feature value corresponds to.

              • ValueAsString (string) –

                The value in string format associated with a feature. Used when your CollectionType is None. Note that features types can be String, Integral, or Fractional. This value represents all three types as a string.

              • ValueAsStringList (list) –

                The list of values in string format associated with a feature. Used when your CollectionType is a List, Set, or Vector. Note that features types can be String, Integral, or Fractional. These values represents all three types as a string.

                • (string) –

          • TargetStores (list) –

            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.

            • (string) –

          • TtlDuration (dict) –

            Time to live duration for this entry, where the record is hard deleted after the expiration time is reached; ExpiresAt = EventTime + TtlDuration. This overrides the request level TtlDuration.

            • Unit (string) –

              TtlDuration time unit.

            • Value (integer) –

              TtlDuration time value.

        • ErrorCode (string) –

          The error code for the failed record write.

        • ErrorMessage (string) –

          The error message for the failed record write.

    • UnprocessedEntries (list) –

      A list of entries that were not processed. These entries can be retried.

      • (dict) –

        An entry to write as part of a BatchWriteRecord request.

        • FeatureGroupName (string) –

          The name or Amazon Resource Name (ARN) of the FeatureGroup to write the record to.

        • Record (list) –

          List of FeatureValues to be inserted. This will be a full over-write.

          • (dict) –

            The value associated with a feature.

            • FeatureName (string) –

              The name of a feature that a feature value corresponds to.

            • ValueAsString (string) –

              The value in string format associated with a feature. Used when your CollectionType is None. Note that features types can be String, Integral, or Fractional. This value represents all three types as a string.

            • ValueAsStringList (list) –

              The list of values in string format associated with a feature. Used when your CollectionType is a List, Set, or Vector. Note that features types can be String, Integral, or Fractional. These values represents all three types as a string.

              • (string) –

        • TargetStores (list) –

          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.

          • (string) –

        • TtlDuration (dict) –

          Time to live duration for this entry, where the record is hard deleted after the expiration time is reached; ExpiresAt = EventTime + TtlDuration. This overrides the request level TtlDuration.

          • Unit (string) –

            TtlDuration time unit.

          • Value (integer) –

            TtlDuration time value.

Exceptions

  • SageMakerFeatureStoreRuntime.Client.exceptions.ValidationError

  • SageMakerFeatureStoreRuntime.Client.exceptions.ResourceNotFound

  • SageMakerFeatureStoreRuntime.Client.exceptions.InternalFailure

  • SageMakerFeatureStoreRuntime.Client.exceptions.ServiceUnavailable

  • SageMakerFeatureStoreRuntime.Client.exceptions.AccessForbidden