Amazon SageMaker Feature Store Runtime

2023/06/27 - Amazon SageMaker Feature Store Runtime - 3 updated api methods

Changes  Introducing TTL for online store records in feature groups.

BatchGetRecord (updated) Link ¶
Changes (request, response)
Request
{'ExpirationTimeResponse': 'Enabled | Disabled'}
Response
{'Records': {'ExpiresAt': '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 of FeatureGroup names, with their corresponding RecordIdentifier value, and Feature name that have been requested to be retrieved in batch.

  • (dict) --

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

    • FeatureGroupName (string) -- [REQUIRED]

      A FeatureGroupName containing 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'
                },
            ],
            '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 associated with a feature, in string format. Note that features types can be String, Integral, or Fractional. This value represents all three types as a 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) --

          A FeatureGroupName containing 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 (request, response)
Request
{'ExpirationTimeResponse': 'Enabled | Disabled'}
Response
{'ExpiresAt': '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 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 , 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

{
    'Record': [
        {
            'FeatureName': 'string',
            'ValueAsString': '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 associated with a feature, in string format. Note that features types can be String, Integral, or Fractional. This value represents all three types as a string.

    • ExpiresAt (string) --

      The ExpiresAt ISO string of the requested record.

PutRecord (updated) Link ¶
Changes (request)
{'TtlDuration': {'Unit': 'Seconds | Minutes | Hours | Days | Weeks',
                 'Value': 'integer'}}

Used for data ingestion into the FeatureStore . The PutRecord API writes to both the OnlineStore and OfflineStore . If the record is the latest record for the recordIdentifier , the record is written to both the OnlineStore and OfflineStore . If the record is a historic record, it is written only to the OfflineStore .

See also: AWS API Documentation

Request Syntax

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

string

param FeatureGroupName

[REQUIRED]

The name 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) -- [REQUIRED]

      The value associated with a feature, in string format. Note that features types can be String, Integral, or Fractional. This value represents all three types as a 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