Amazon SageMaker Feature Store Runtime

2023/09/28 - Amazon SageMaker Feature Store Runtime - 3 updated api methods

Changes  Online store feature groups supports Standard and InMemory tier storage types for low latency storage for real-time data retrieval. The InMemory tier supports collection types List, Set, and Vector.

BatchGetRecord (updated) Link ¶
Changes (response)
{'Records': {'Record': {'ValueAsStringList': ['string']}}}

Retrieves a batch of Records from a FeatureGroup.

See also: AWS API Documentation

Request Syntax

client.batch_get_record(
    Identifiers=[
        {
            'FeatureGroupName': 'string',
            'RecordIdentifiersValueAsString': [
                'string',
            ],
            'FeatureNames': [
                'string',
            ]
        },
    ],
    ExpirationTimeResponse='Enabled'|'Disabled'
)
type Identifiers:

list

param Identifiers:

[REQUIRED]

A list containing the name or Amazon Resource Name (ARN) of the FeatureGroup, the list of names of Feature``s to be retrieved, and the corresponding ``RecordIdentifier values as strings.

  • (dict) --

    The identifier that identifies the batch of Records you are retrieving in a batch.

    • FeatureGroupName (string) -- [REQUIRED]

      The name or Amazon Resource Name (ARN) of the FeatureGroup containing the records you are retrieving in a batch.

    • RecordIdentifiersValueAsString (list) -- [REQUIRED]

      The value for a list of record identifiers in string format.

      • (string) --

    • FeatureNames (list) --

      List of names of Features to be retrieved. If not specified, the latest value for all the Features are returned.

      • (string) --

type ExpirationTimeResponse:

string

param ExpirationTimeResponse:

Parameter to request ExpiresAt in response. If Enabled, BatchGetRecord will return the value of ExpiresAt, if it is not null. If Disabled and null, BatchGetRecord will return null.

rtype:

dict

returns:

Response Syntax

{
    'Records': [
        {
            'FeatureGroupName': 'string',
            'RecordIdentifierValueAsString': 'string',
            'Record': [
                {
                    'FeatureName': 'string',
                    'ValueAsString': 'string',
                    'ValueAsStringList': [
                        'string',
                    ]
                },
            ],
            'ExpiresAt': 'string'
        },
    ],
    'Errors': [
        {
            'FeatureGroupName': 'string',
            'RecordIdentifierValueAsString': 'string',
            'ErrorCode': 'string',
            'ErrorMessage': 'string'
        },
    ],
    'UnprocessedIdentifiers': [
        {
            'FeatureGroupName': 'string',
            'RecordIdentifiersValueAsString': [
                'string',
            ],
            'FeatureNames': [
                'string',
            ]
        },
    ]
}

Response Structure

  • (dict) --

    • Records (list) --

      A list of Records you requested to be retrieved in batch.

      • (dict) --

        The output of records that have been retrieved in a batch.

        • FeatureGroupName (string) --

          The FeatureGroupName containing Records you retrieved in a batch.

        • RecordIdentifierValueAsString (string) --

          The value of the record identifier in string format.

        • Record (list) --

          The Record retrieved.

          • (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) --

        • ExpiresAt (string) --

          The ExpiresAt ISO string of the requested record.

    • Errors (list) --

      A list of errors that have occurred when retrieving a batch of Records.

      • (dict) --

        The error that has occurred when attempting to retrieve a batch of Records.

        • FeatureGroupName (string) --

          The name of the feature group that the record belongs to.

        • RecordIdentifierValueAsString (string) --

          The value for the RecordIdentifier in string format of a Record from a FeatureGroup that is causing an error when attempting to be retrieved.

        • ErrorCode (string) --

          The error code of an error that has occurred when attempting to retrieve a batch of Records. For more information on errors, see Errors.

        • ErrorMessage (string) --

          The error message of an error that has occurred when attempting to retrieve a record in the batch.

    • UnprocessedIdentifiers (list) --

      A unprocessed list of FeatureGroup names, with their corresponding RecordIdentifier value, and Feature name.

      • (dict) --

        The identifier that identifies the batch of Records you are retrieving in a batch.

        • FeatureGroupName (string) --

          The name or Amazon Resource Name (ARN) of the FeatureGroup containing the records you are retrieving in a batch.

        • RecordIdentifiersValueAsString (list) --

          The value for a list of record identifiers in string format.

          • (string) --

        • FeatureNames (list) --

          List of names of Features to be retrieved. If not specified, the latest value for all the Features are returned.

          • (string) --

GetRecord (updated) Link ¶
Changes (response)
{'Record': {'ValueAsStringList': ['string']}}

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.

See also: AWS API Documentation

Request Syntax

client.get_record(
    FeatureGroupName='string',
    RecordIdentifierValueAsString='string',
    FeatureNames=[
        'string',
    ],
    ExpirationTimeResponse='Enabled'|'Disabled'
)
type FeatureGroupName:

string

param FeatureGroupName:

[REQUIRED]

The name or Amazon Resource Name (ARN) of the feature group from which you want to retrieve a record.

type RecordIdentifierValueAsString:

string

param RecordIdentifierValueAsString:

[REQUIRED]

The value that corresponds to RecordIdentifier type and uniquely identifies the record in the FeatureGroup.

type FeatureNames:

list

param FeatureNames:

List of names of Features to be retrieved. If not specified, the latest value for all the Features are returned.

  • (string) --

type ExpirationTimeResponse:

string

param ExpirationTimeResponse:

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

rtype:

dict

returns:

Response Syntax

{
    'Record': [
        {
            'FeatureName': 'string',
            'ValueAsString': 'string',
            'ValueAsStringList': [
                'string',
            ]
        },
    ],
    'ExpiresAt': 'string'
}

Response Structure

  • (dict) --

    • Record (list) --

      The record you requested. A list of FeatureValues.

      • (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) --

    • ExpiresAt (string) --

      The ExpiresAt ISO string of the requested record.

PutRecord (updated) Link ¶
Changes (request)
{'Record': {'ValueAsStringList': ['string']}}

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.

See also: AWS API Documentation

Request Syntax

client.put_record(
    FeatureGroupName='string',
    Record=[
        {
            'FeatureName': 'string',
            'ValueAsString': 'string',
            'ValueAsStringList': [
                'string',
            ]
        },
    ],
    TargetStores=[
        'OnlineStore'|'OfflineStore',
    ],
    TtlDuration={
        'Unit': 'Seconds'|'Minutes'|'Hours'|'Days'|'Weeks',
        'Value': 123
    }
)
type FeatureGroupName:

string

param FeatureGroupName:

[REQUIRED]

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

type Record:

list

param Record:

[REQUIRED]

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.

  • (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) --

type TargetStores:

list

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

  • (string) --

type TtlDuration:

dict

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

  • Unit (string) -- [REQUIRED]

    TtlDuration time unit.

  • Value (integer) -- [REQUIRED]

    TtlDuration time value.

returns:

None