Amazon Forecast Service

2023/02/01 - Amazon Forecast Service - 3 updated api methods

Changes  This release will enable customer select INCREMENTAL as ImportModel in Forecast's CreateDatasetImportJob API. Verified latest SDK containing required attribute, following https://w.amazon.com/bin/view/AWS-Seer/Launch/Trebuchet/

CreateDatasetImportJob (updated) Link ¶
Changes (request)
{'ImportMode': 'FULL | INCREMENTAL'}

Imports your training data to an Amazon Forecast dataset. You provide the location of your training data in an Amazon Simple Storage Service (Amazon S3) bucket and the Amazon Resource Name (ARN) of the dataset that you want to import the data to.

You must specify a DataSource object that includes an Identity and Access Management (IAM) role that Amazon Forecast can assume to access the data, as Amazon Forecast makes a copy of your data and processes it in an internal Amazon Web Services system. For more information, see Set up permissions.

The training data must be in CSV or Parquet format. The delimiter must be a comma (,).

You can specify the path to a specific file, the S3 bucket, or to a folder in the S3 bucket. For the latter two cases, Amazon Forecast imports all files up to the limit of 10,000 files.

Because dataset imports are not aggregated, your most recent dataset import is the one that is used when training a predictor or generating a forecast. Make sure that your most recent dataset import contains all of the data you want to model off of, and not just the new data collected since the previous import.

To get a list of all your dataset import jobs, filtered by specified criteria, use the ListDatasetImportJobs operation.

See also: AWS API Documentation

Request Syntax

client.create_dataset_import_job(
    DatasetImportJobName='string',
    DatasetArn='string',
    DataSource={
        'S3Config': {
            'Path': 'string',
            'RoleArn': 'string',
            'KMSKeyArn': 'string'
        }
    },
    TimestampFormat='string',
    TimeZone='string',
    UseGeolocationForTimeZone=True|False,
    GeolocationFormat='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    Format='string',
    ImportMode='FULL'|'INCREMENTAL'
)
type DatasetImportJobName:

string

param DatasetImportJobName:

[REQUIRED]

The name for the dataset import job. We recommend including the current timestamp in the name, for example, 20190721DatasetImport. This can help you avoid getting a ResourceAlreadyExistsException exception.

type DatasetArn:

string

param DatasetArn:

[REQUIRED]

The Amazon Resource Name (ARN) of the Amazon Forecast dataset that you want to import data to.

type DataSource:

dict

param DataSource:

[REQUIRED]

The location of the training data to import and an Identity and Access Management (IAM) role that Amazon Forecast can assume to access the data. The training data must be stored in an Amazon S3 bucket.

If encryption is used, DataSource must include an Key Management Service (KMS) key and the IAM role must allow Amazon Forecast permission to access the key. The KMS key and IAM role must match those specified in the EncryptionConfig parameter of the CreateDataset operation.

  • S3Config (dict) -- [REQUIRED]

    The path to the data stored in an Amazon Simple Storage Service (Amazon S3) bucket along with the credentials to access the data.

    • Path (string) -- [REQUIRED]

      The path to an Amazon Simple Storage Service (Amazon S3) bucket or file(s) in an Amazon S3 bucket.

    • RoleArn (string) -- [REQUIRED]

      The ARN of the Identity and Access Management (IAM) role that Amazon Forecast can assume to access the Amazon S3 bucket or files. If you provide a value for the KMSKeyArn key, the role must allow access to the key.

      Passing a role across Amazon Web Services accounts is not allowed. If you pass a role that isn't in your account, you get an InvalidInputException error.

    • KMSKeyArn (string) --

      The Amazon Resource Name (ARN) of an Key Management Service (KMS) key.

type TimestampFormat:

string

param TimestampFormat:

The format of timestamps in the dataset. The format that you specify depends on the DataFrequency specified when the dataset was created. The following formats are supported

  • "yyyy-MM-dd" For the following data frequencies: Y, M, W, and D

  • "yyyy-MM-dd HH:mm:ss" For the following data frequencies: H, 30min, 15min, and 1min; and optionally, for: Y, M, W, and D

If the format isn't specified, Amazon Forecast expects the format to be "yyyy-MM-dd HH:mm:ss".

type TimeZone:

string

param TimeZone:

A single time zone for every item in your dataset. This option is ideal for datasets with all timestamps within a single time zone, or if all timestamps are normalized to a single time zone.

Refer to the Joda-Time API for a complete list of valid time zone names.

type UseGeolocationForTimeZone:

boolean

param UseGeolocationForTimeZone:

Automatically derive time zone information from the geolocation attribute. This option is ideal for datasets that contain timestamps in multiple time zones and those timestamps are expressed in local time.

type GeolocationFormat:

string

param GeolocationFormat:

The format of the geolocation attribute. The geolocation attribute can be formatted in one of two ways:

  • LAT_LONG - the latitude and longitude in decimal format (Example: 47.61_-122.33).

  • CC_POSTALCODE (US Only) - the country code (US), followed by the 5-digit ZIP code (Example: US_98121).

type Tags:

list

param Tags:

The optional metadata that you apply to the dataset import job to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.

The following basic restrictions apply to tags:

  • Maximum number of tags per resource - 50.

  • For each resource, each tag key must be unique, and each tag key can have only one value.

  • Maximum key length - 128 Unicode characters in UTF-8.

  • Maximum value length - 256 Unicode characters in UTF-8.

  • If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @.

  • Tag keys and values are case sensitive.

  • Do not use aws:, AWS:, or any upper or lowercase combination of such as a prefix for keys as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys with this prefix. Values can have this prefix. If a tag value has aws as its prefix but the key does not, then Forecast considers it to be a user tag and will count against the limit of 50 tags. Tags with only the key prefix of aws do not count against your tags per resource limit.

  • (dict) --

    The optional metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define.

    The following basic restrictions apply to tags:

    • Maximum number of tags per resource - 50.

    • For each resource, each tag key must be unique, and each tag key can have only one value.

    • Maximum key length - 128 Unicode characters in UTF-8.

    • Maximum value length - 256 Unicode characters in UTF-8.

    • If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @.

    • Tag keys and values are case sensitive.

    • Do not use aws:, AWS:, or any upper or lowercase combination of such as a prefix for keys as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys with this prefix. Values can have this prefix. If a tag value has aws as its prefix but the key does not, then Forecast considers it to be a user tag and will count against the limit of 50 tags. Tags with only the key prefix of aws do not count against your tags per resource limit.

    • Key (string) -- [REQUIRED]

      One part of a key-value pair that makes up a tag. A key is a general label that acts like a category for more specific tag values.

    • Value (string) -- [REQUIRED]

      The optional part of a key-value pair that makes up a tag. A value acts as a descriptor within a tag category (key).

type Format:

string

param Format:

The format of the imported data, CSV or PARQUET. The default value is CSV.

type ImportMode:

string

param ImportMode:

Specifies whether the dataset import job is a FULL or INCREMENTAL import. A FULL dataset import replaces all of the existing data with the newly imported data. An INCREMENTAL import appends the imported data to the existing data.

rtype:

dict

returns:

Response Syntax

{
    'DatasetImportJobArn': 'string'
}

Response Structure

  • (dict) --

    • DatasetImportJobArn (string) --

      The Amazon Resource Name (ARN) of the dataset import job.

DescribeDatasetImportJob (updated) Link ¶
Changes (response)
{'ImportMode': 'FULL | INCREMENTAL'}

Describes a dataset import job created using the CreateDatasetImportJob operation.

In addition to listing the parameters provided in the CreateDatasetImportJob request, this operation includes the following properties:

  • CreationTime

  • LastModificationTime

  • DataSize

  • FieldStatistics

  • Status

  • Message - If an error occurred, information about the error.

See also: AWS API Documentation

Request Syntax

client.describe_dataset_import_job(
    DatasetImportJobArn='string'
)
type DatasetImportJobArn:

string

param DatasetImportJobArn:

[REQUIRED]

The Amazon Resource Name (ARN) of the dataset import job.

rtype:

dict

returns:

Response Syntax

{
    'DatasetImportJobName': 'string',
    'DatasetImportJobArn': 'string',
    'DatasetArn': 'string',
    'TimestampFormat': 'string',
    'TimeZone': 'string',
    'UseGeolocationForTimeZone': True|False,
    'GeolocationFormat': 'string',
    'DataSource': {
        'S3Config': {
            'Path': 'string',
            'RoleArn': 'string',
            'KMSKeyArn': 'string'
        }
    },
    'EstimatedTimeRemainingInMinutes': 123,
    'FieldStatistics': {
        'string': {
            'Count': 123,
            'CountDistinct': 123,
            'CountNull': 123,
            'CountNan': 123,
            'Min': 'string',
            'Max': 'string',
            'Avg': 123.0,
            'Stddev': 123.0,
            'CountLong': 123,
            'CountDistinctLong': 123,
            'CountNullLong': 123,
            'CountNanLong': 123
        }
    },
    'DataSize': 123.0,
    'Status': 'string',
    'Message': 'string',
    'CreationTime': datetime(2015, 1, 1),
    'LastModificationTime': datetime(2015, 1, 1),
    'Format': 'string',
    'ImportMode': 'FULL'|'INCREMENTAL'
}

Response Structure

  • (dict) --

    • DatasetImportJobName (string) --

      The name of the dataset import job.

    • DatasetImportJobArn (string) --

      The ARN of the dataset import job.

    • DatasetArn (string) --

      The Amazon Resource Name (ARN) of the dataset that the training data was imported to.

    • TimestampFormat (string) --

      The format of timestamps in the dataset. The format that you specify depends on the DataFrequency specified when the dataset was created. The following formats are supported

      • "yyyy-MM-dd" For the following data frequencies: Y, M, W, and D

      • "yyyy-MM-dd HH:mm:ss" For the following data frequencies: H, 30min, 15min, and 1min; and optionally, for: Y, M, W, and D

    • TimeZone (string) --

      The single time zone applied to every item in the dataset

    • UseGeolocationForTimeZone (boolean) --

      Whether TimeZone is automatically derived from the geolocation attribute.

    • GeolocationFormat (string) --

      The format of the geolocation attribute. Valid Values: "LAT_LONG" and "CC_POSTALCODE".

    • DataSource (dict) --

      The location of the training data to import and an Identity and Access Management (IAM) role that Amazon Forecast can assume to access the data.

      If encryption is used, DataSource includes an Key Management Service (KMS) key.

      • S3Config (dict) --

        The path to the data stored in an Amazon Simple Storage Service (Amazon S3) bucket along with the credentials to access the data.

        • Path (string) --

          The path to an Amazon Simple Storage Service (Amazon S3) bucket or file(s) in an Amazon S3 bucket.

        • RoleArn (string) --

          The ARN of the Identity and Access Management (IAM) role that Amazon Forecast can assume to access the Amazon S3 bucket or files. If you provide a value for the KMSKeyArn key, the role must allow access to the key.

          Passing a role across Amazon Web Services accounts is not allowed. If you pass a role that isn't in your account, you get an InvalidInputException error.

        • KMSKeyArn (string) --

          The Amazon Resource Name (ARN) of an Key Management Service (KMS) key.

    • EstimatedTimeRemainingInMinutes (integer) --

      The estimated time remaining in minutes for the dataset import job to complete.

    • FieldStatistics (dict) --

      Statistical information about each field in the input data.

      • (string) --

        • (dict) --

          Provides statistics for each data field imported into to an Amazon Forecast dataset with the CreateDatasetImportJob operation.

          • Count (integer) --

            The number of values in the field. If the response value is -1, refer to CountLong.

          • CountDistinct (integer) --

            The number of distinct values in the field. If the response value is -1, refer to CountDistinctLong.

          • CountNull (integer) --

            The number of null values in the field. If the response value is -1, refer to CountNullLong.

          • CountNan (integer) --

            The number of NAN (not a number) values in the field. If the response value is -1, refer to CountNanLong.

          • Min (string) --

            For a numeric field, the minimum value in the field.

          • Max (string) --

            For a numeric field, the maximum value in the field.

          • Avg (float) --

            For a numeric field, the average value in the field.

          • Stddev (float) --

            For a numeric field, the standard deviation.

          • CountLong (integer) --

            The number of values in the field. CountLong is used instead of Count if the value is greater than 2,147,483,647.

          • CountDistinctLong (integer) --

            The number of distinct values in the field. CountDistinctLong is used instead of CountDistinct if the value is greater than 2,147,483,647.

          • CountNullLong (integer) --

            The number of null values in the field. CountNullLong is used instead of CountNull if the value is greater than 2,147,483,647.

          • CountNanLong (integer) --

            The number of NAN (not a number) values in the field. CountNanLong is used instead of CountNan if the value is greater than 2,147,483,647.

    • DataSize (float) --

      The size of the dataset in gigabytes (GB) after the import job has finished.

    • Status (string) --

      The status of the dataset import job. States include:

      • ACTIVE

      • CREATE_PENDING, CREATE_IN_PROGRESS, CREATE_FAILED

      • DELETE_PENDING, DELETE_IN_PROGRESS, DELETE_FAILED

      • CREATE_STOPPING, CREATE_STOPPED

    • Message (string) --

      If an error occurred, an informational message about the error.

    • CreationTime (datetime) --

      When the dataset import job was created.

    • LastModificationTime (datetime) --

      The last time the resource was modified. The timestamp depends on the status of the job:

      • CREATE_PENDING - The CreationTime.

      • CREATE_IN_PROGRESS - The current timestamp.

      • CREATE_STOPPING - The current timestamp.

      • CREATE_STOPPED - When the job stopped.

      • ACTIVE or CREATE_FAILED - When the job finished or failed.

    • Format (string) --

      The format of the imported data, CSV or PARQUET.

    • ImportMode (string) --

      The import mode of the dataset import job, FULL or INCREMENTAL.

ListDatasetImportJobs (updated) Link ¶
Changes (response)
{'DatasetImportJobs': {'ImportMode': 'FULL | INCREMENTAL'}}

Returns a list of dataset import jobs created using the CreateDatasetImportJob operation. For each import job, this operation returns a summary of its properties, including its Amazon Resource Name (ARN). You can retrieve the complete set of properties by using the ARN with the DescribeDatasetImportJob operation. You can filter the list by providing an array of Filter objects.

See also: AWS API Documentation

Request Syntax

client.list_dataset_import_jobs(
    NextToken='string',
    MaxResults=123,
    Filters=[
        {
            'Key': 'string',
            'Value': 'string',
            'Condition': 'IS'|'IS_NOT'
        },
    ]
)
type NextToken:

string

param NextToken:

If the result of the previous request was truncated, the response includes a NextToken. To retrieve the next set of results, use the token in the next request. Tokens expire after 24 hours.

type MaxResults:

integer

param MaxResults:

The number of items to return in the response.

type Filters:

list

param Filters:

An array of filters. For each filter, you provide a condition and a match statement. The condition is either IS or IS_NOT, which specifies whether to include or exclude the datasets that match the statement from the list, respectively. The match statement consists of a key and a value.

Filter properties

  • Condition - The condition to apply. Valid values are IS and IS_NOT. To include the datasets that match the statement, specify IS. To exclude matching datasets, specify IS_NOT.

  • Key - The name of the parameter to filter on. Valid values are DatasetArn and Status.

  • Value - The value to match.

For example, to list all dataset import jobs whose status is ACTIVE, you specify the following filter:

"Filters": [ { "Condition": "IS", "Key": "Status", "Value": "ACTIVE" } ]

  • (dict) --

    Describes a filter for choosing a subset of objects. Each filter consists of a condition and a match statement. The condition is either IS or IS_NOT, which specifies whether to include or exclude the objects that match the statement, respectively. The match statement consists of a key and a value.

    • Key (string) -- [REQUIRED]

      The name of the parameter to filter on.

    • Value (string) -- [REQUIRED]

      The value to match.

    • Condition (string) -- [REQUIRED]

      The condition to apply. To include the objects that match the statement, specify IS. To exclude matching objects, specify IS_NOT.

rtype:

dict

returns:

Response Syntax

{
    'DatasetImportJobs': [
        {
            'DatasetImportJobArn': 'string',
            'DatasetImportJobName': 'string',
            'DataSource': {
                'S3Config': {
                    'Path': 'string',
                    'RoleArn': 'string',
                    'KMSKeyArn': 'string'
                }
            },
            'Status': 'string',
            'Message': 'string',
            'CreationTime': datetime(2015, 1, 1),
            'LastModificationTime': datetime(2015, 1, 1),
            'ImportMode': 'FULL'|'INCREMENTAL'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • DatasetImportJobs (list) --

      An array of objects that summarize each dataset import job's properties.

      • (dict) --

        Provides a summary of the dataset import job properties used in the ListDatasetImportJobs operation. To get the complete set of properties, call the DescribeDatasetImportJob operation, and provide the DatasetImportJobArn.

        • DatasetImportJobArn (string) --

          The Amazon Resource Name (ARN) of the dataset import job.

        • DatasetImportJobName (string) --

          The name of the dataset import job.

        • DataSource (dict) --

          The location of the training data to import and an Identity and Access Management (IAM) role that Amazon Forecast can assume to access the data. The training data must be stored in an Amazon S3 bucket.

          If encryption is used, DataSource includes an Key Management Service (KMS) key.

          • S3Config (dict) --

            The path to the data stored in an Amazon Simple Storage Service (Amazon S3) bucket along with the credentials to access the data.

            • Path (string) --

              The path to an Amazon Simple Storage Service (Amazon S3) bucket or file(s) in an Amazon S3 bucket.

            • RoleArn (string) --

              The ARN of the Identity and Access Management (IAM) role that Amazon Forecast can assume to access the Amazon S3 bucket or files. If you provide a value for the KMSKeyArn key, the role must allow access to the key.

              Passing a role across Amazon Web Services accounts is not allowed. If you pass a role that isn't in your account, you get an InvalidInputException error.

            • KMSKeyArn (string) --

              The Amazon Resource Name (ARN) of an Key Management Service (KMS) key.

        • Status (string) --

          The status of the dataset import job. States include:

          • ACTIVE

          • CREATE_PENDING, CREATE_IN_PROGRESS, CREATE_FAILED

          • DELETE_PENDING, DELETE_IN_PROGRESS, DELETE_FAILED

          • CREATE_STOPPING, CREATE_STOPPED

        • Message (string) --

          If an error occurred, an informational message about the error.

        • CreationTime (datetime) --

          When the dataset import job was created.

        • LastModificationTime (datetime) --

          The last time the resource was modified. The timestamp depends on the status of the job:

          • CREATE_PENDING - The CreationTime.

          • CREATE_IN_PROGRESS - The current timestamp.

          • CREATE_STOPPING - The current timestamp.

          • CREATE_STOPPED - When the job stopped.

          • ACTIVE or CREATE_FAILED - When the job finished or failed.

        • ImportMode (string) --

          The import mode of the dataset import job, FULL or INCREMENTAL.

    • NextToken (string) --

      If the response is truncated, Amazon Forecast returns this token. To retrieve the next set of results, use the token in the next request.