Skip to content

create_feature_group async

create_feature_group(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    feature_group_name: Optional[FeatureGroupName] = None,
    record_identifier_feature_name: Optional[FeatureName] = None,
    event_time_feature_name: Optional[FeatureName] = None,
    feature_definitions: Optional[FeatureDefinitions] = None,
    online_store_config: Optional[OnlineStoreConfig] = None,
    offline_store_config: Optional[OfflineStoreConfig] = None,
    throughput_config: Optional[ThroughputConfig] = None,
    role_arn: Optional[RoleArn] = None,
    description: Optional[Description] = None,
    tags: Optional[TagList] = None,
) -> CreateFeatureGroupResponse

Create a new FeatureGroup. A FeatureGroup is a group of Features defined in the FeatureStore to describe a Record.

The FeatureGroup defines the schema and features contained in the FeatureGroup. A FeatureGroup definition is composed of a list of Features, a RecordIdentifierFeatureName, an EventTimeFeatureName and configurations for its OnlineStore and OfflineStore. Check Amazon Web Services service quotas to see the FeatureGroups quota for your Amazon Web Services account.

Note that it can take approximately 10-15 minutes to provision an OnlineStore FeatureGroup with the InMemory StorageType.

You must include at least one of OnlineStoreConfig and OfflineStoreConfig to create a FeatureGroup.

Parameters:

  • feature_group_name (Optional[FeatureGroupName], default: None ) –

    The name of the FeatureGroup. The name must be unique within an Amazon Web Services Region in an Amazon Web Services account.

    The name:

    • Must start with an alphanumeric character.

    • Can only include alphanumeric characters, underscores, and hyphens. Spaces are not allowed.

  • record_identifier_feature_name (Optional[FeatureName], default: None ) –

    The name of the Feature whose value uniquely identifies a Record defined in the FeatureStore. Only the latest record per identifier value will be stored in the OnlineStore. RecordIdentifierFeatureName must be one of feature definitions' names.

    You use the RecordIdentifierFeatureName to access data in a FeatureStore.

    This name:

    • Must start with an alphanumeric character.

    • Can only contains alphanumeric characters, hyphens, underscores. Spaces are not allowed.

  • event_time_feature_name (Optional[FeatureName], default: None ) –

    The name of the feature that stores the EventTime of a Record in a FeatureGroup.

    An EventTime is a point in time when a new event occurs that corresponds to the creation or update of a Record in a FeatureGroup. All Records in the FeatureGroup must have a corresponding EventTime.

    An EventTime can be a String or Fractional.

    • Fractional: EventTime feature values must be a Unix timestamp in seconds.

    • String: EventTime feature values must be an ISO-8601 string in the format. The following formats are supported yyyy-MM-dd'T'HH:mm:ssZ and yyyy-MM-dd'T'HH:mm:ss.SSSZ where yyyy, MM, and dd represent the year, month, and day respectively and HH, mm, ss, and if applicable, SSS represent the hour, month, second and milliseconds respsectively. 'T' and Z are constants.

  • feature_definitions (Optional[FeatureDefinitions], default: None ) –

    A list of Feature names and types. Name and Type is compulsory per Feature.

    Valid feature FeatureTypes are Integral, Fractional and String.

    FeatureNames cannot be any of the following: is_deleted, write_time, api_invocation_time

    You can create up to 2,500 FeatureDefinitions per FeatureGroup.

  • online_store_config (Optional[OnlineStoreConfig], default: None ) –

    You can turn the OnlineStore on or off by specifying True for the EnableOnlineStore flag in OnlineStoreConfig.

    You can also include an Amazon Web Services KMS key ID (KMSKeyId) for at-rest encryption of the OnlineStore.

    The default value is False.

  • offline_store_config (Optional[OfflineStoreConfig], default: None ) –

    Use this to configure an OfflineFeatureStore. This parameter allows you to specify:

    • The Amazon Simple Storage Service (Amazon S3) location of an OfflineStore.

    • A configuration for an Amazon Web Services Glue or Amazon Web Services Hive data catalog.

    • An KMS encryption key to encrypt the Amazon S3 location used for OfflineStore. If KMS encryption key is not specified, by default we encrypt all data at rest using Amazon Web Services KMS key. By defining your bucket-level key for SSE, you can reduce Amazon Web Services KMS requests costs by up to 99 percent.

    • Format for the offline store table. Supported formats are Glue (Default) and Apache Iceberg.

    To learn more about this parameter, see OfflineStoreConfig.

  • role_arn (Optional[RoleArn], default: None ) –

    The Amazon Resource Name (ARN) of the IAM execution role used to persist data into the OfflineStore if an OfflineStoreConfig is provided.

  • description (Optional[Description], default: None ) –

    A free-form description of a FeatureGroup.

  • tags (Optional[TagList], default: None ) –

    Tags used to identify Features in each FeatureGroup.

Raises:

  • ResourceInUse –

    Resource being accessed is in use.

  • ResourceLimitExceeded –

    You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
async def create_feature_group(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    feature_group_name: Optional[
        "capo_sagemaker.types.feature_group_name.FeatureGroupName"
    ] = None,
    record_identifier_feature_name: Optional[
        "capo_sagemaker.types.feature_name.FeatureName"
    ] = None,
    event_time_feature_name: Optional[
        "capo_sagemaker.types.feature_name.FeatureName"
    ] = None,
    feature_definitions: Optional[
        "capo_sagemaker.types.feature_definitions.FeatureDefinitions"
    ] = None,
    online_store_config: Optional[
        "capo_sagemaker.types.online_store_config.OnlineStoreConfig"
    ] = None,
    offline_store_config: Optional[
        "capo_sagemaker.types.offline_store_config.OfflineStoreConfig"
    ] = None,
    throughput_config: Optional[
        "capo_sagemaker.types.throughput_config.ThroughputConfig"
    ] = None,
    role_arn: Optional["capo_sagemaker.types.role_arn.RoleArn"] = None,
    description: Optional["capo_sagemaker.types.description.Description"] = None,
    tags: Optional["capo_sagemaker.types.tag_list.TagList"] = None,
) -> (
    "capo_sagemaker.types.create_feature_group_response.CreateFeatureGroupResponse"
):
    """<p>Create a new <code>FeatureGroup</code>. A <code>FeatureGroup</code> is a group of <code>Features</code> defined in the <code>FeatureStore</code> to describe a <code>Record</code>. </p> <p>The <code>FeatureGroup</code> defines the schema and features contained in the <code>FeatureGroup</code>. A <code>FeatureGroup</code> definition is composed of a list of <code>Features</code>, a <code>RecordIdentifierFeatureName</code>, an <code>EventTimeFeatureName</code> and configurations for its <code>OnlineStore</code> and <code>OfflineStore</code>. Check <a href="https://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html">Amazon Web Services service quotas</a> to see the <code>FeatureGroup</code>s quota for your Amazon Web Services account.</p> <p>Note that it can take approximately 10-15 minutes to provision an <code>OnlineStore</code> <code>FeatureGroup</code> with the <code>InMemory</code> <code>StorageType</code>.</p> <important> <p>You must include at least one of <code>OnlineStoreConfig</code> and <code>OfflineStoreConfig</code> to create a <code>FeatureGroup</code>.</p> </important>

    Args:
        feature_group_name: <p>The name of the <code>FeatureGroup</code>. The name must be unique within an Amazon Web Services Region in an Amazon Web Services account.</p> <p>The name:</p> <ul> <li> <p>Must start with an alphanumeric character.</p> </li> <li> <p>Can only include alphanumeric characters, underscores, and hyphens. Spaces are not allowed.</p> </li> </ul>
        record_identifier_feature_name: <p>The name of the <code>Feature</code> whose value uniquely identifies a <code>Record</code> defined in the <code>FeatureStore</code>. Only the latest record per identifier value will be stored in the <code>OnlineStore</code>. <code>RecordIdentifierFeatureName</code> must be one of feature definitions' names.</p> <p>You use the <code>RecordIdentifierFeatureName</code> to access data in a <code>FeatureStore</code>.</p> <p>This name:</p> <ul> <li> <p>Must start with an alphanumeric character.</p> </li> <li> <p>Can only contains alphanumeric characters, hyphens, underscores. Spaces are not allowed. </p> </li> </ul>
        event_time_feature_name: <p>The name of the feature that stores the <code>EventTime</code> of a <code>Record</code> in a <code>FeatureGroup</code>.</p> <p>An <code>EventTime</code> is a point in time when a new event occurs that corresponds to the creation or update of a <code>Record</code> in a <code>FeatureGroup</code>. All <code>Records</code> in the <code>FeatureGroup</code> must have a corresponding <code>EventTime</code>.</p> <p>An <code>EventTime</code> can be a <code>String</code> or <code>Fractional</code>. </p> <ul> <li> <p> <code>Fractional</code>: <code>EventTime</code> feature values must be a Unix timestamp in seconds.</p> </li> <li> <p> <code>String</code>: <code>EventTime</code> feature values must be an ISO-8601 string in the format. The following formats are supported <code>yyyy-MM-dd'T'HH:mm:ssZ</code> and <code>yyyy-MM-dd'T'HH:mm:ss.SSSZ</code> where <code>yyyy</code>, <code>MM</code>, and <code>dd</code> represent the year, month, and day respectively and <code>HH</code>, <code>mm</code>, <code>ss</code>, and if applicable, <code>SSS</code> represent the hour, month, second and milliseconds respsectively. <code>'T'</code> and <code>Z</code> are constants.</p> </li> </ul>
        feature_definitions: <p>A list of <code>Feature</code> names and types. <code>Name</code> and <code>Type</code> is compulsory per <code>Feature</code>. </p> <p>Valid feature <code>FeatureType</code>s are <code>Integral</code>, <code>Fractional</code> and <code>String</code>.</p> <p> <code>FeatureName</code>s cannot be any of the following: <code>is_deleted</code>, <code>write_time</code>, <code>api_invocation_time</code> </p> <p>You can create up to 2,500 <code>FeatureDefinition</code>s per <code>FeatureGroup</code>.</p>
        online_store_config: <p>You can turn the <code>OnlineStore</code> on or off by specifying <code>True</code> for the <code>EnableOnlineStore</code> flag in <code>OnlineStoreConfig</code>.</p> <p>You can also include an Amazon Web Services KMS key ID (<code>KMSKeyId</code>) for at-rest encryption of the <code>OnlineStore</code>.</p> <p>The default value is <code>False</code>.</p>
        offline_store_config: <p>Use this to configure an <code>OfflineFeatureStore</code>. This parameter allows you to specify:</p> <ul> <li> <p>The Amazon Simple Storage Service (Amazon S3) location of an <code>OfflineStore</code>.</p> </li> <li> <p>A configuration for an Amazon Web Services Glue or Amazon Web Services Hive data catalog. </p> </li> <li> <p>An KMS encryption key to encrypt the Amazon S3 location used for <code>OfflineStore</code>. If KMS encryption key is not specified, by default we encrypt all data at rest using Amazon Web Services KMS key. By defining your <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucket-key.html">bucket-level key</a> for SSE, you can reduce Amazon Web Services KMS requests costs by up to 99 percent.</p> </li> <li> <p>Format for the offline store table. Supported formats are Glue (Default) and <a href="https://iceberg.apache.org/">Apache Iceberg</a>.</p> </li> </ul> <p>To learn more about this parameter, see <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_OfflineStoreConfig.html">OfflineStoreConfig</a>.</p>
        role_arn: <p>The Amazon Resource Name (ARN) of the IAM execution role used to persist data into the <code>OfflineStore</code> if an <code>OfflineStoreConfig</code> is provided.</p>
        description: <p>A free-form description of a <code>FeatureGroup</code>.</p>
        tags: <p>Tags used to identify <code>Features</code> in each <code>FeatureGroup</code>.</p>

    Raises:
        capo_sagemaker.errors.resource_in_use.ResourceInUse: <p>Resource being accessed is in use.</p>
        capo_sagemaker.errors.resource_limit_exceeded.ResourceLimitExceeded: <p> You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created. </p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker.types.create_feature_group_request.CreateFeatureGroupRequest]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.create_feature_group_response.CreateFeatureGroupResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.create_feature_group

        (
            output,
            http_response,
        ) = await capo_sagemaker._operations.sage_maker.create_feature_group.async_create_feature_group(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateFeatureGroup")
    )
    input_: capo_sagemaker.types.create_feature_group_request.CreateFeatureGroupRequest = {}
    if feature_group_name is not None:
        input_["feature_group_name"] = feature_group_name
    if record_identifier_feature_name is not None:
        input_["record_identifier_feature_name"] = record_identifier_feature_name
    if event_time_feature_name is not None:
        input_["event_time_feature_name"] = event_time_feature_name
    if feature_definitions is not None:
        input_["feature_definitions"] = feature_definitions
    if online_store_config is not None:
        input_["online_store_config"] = online_store_config
    if offline_store_config is not None:
        input_["offline_store_config"] = offline_store_config
    if throughput_config is not None:
        input_["throughput_config"] = throughput_config
    if role_arn is not None:
        input_["role_arn"] = role_arn
    if description is not None:
        input_["description"] = description
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output