CustomerProfiles / Client / create_calculated_attribute_definition

create_calculated_attribute_definition#

CustomerProfiles.Client.create_calculated_attribute_definition(**kwargs)#

Creates a new calculated attribute definition. After creation, new object data ingested into Customer Profiles will be included in the calculated attribute, which can be retrieved for a profile using the GetCalculatedAttributeForProfile API. Defining a calculated attribute makes it available for all profiles within a domain. Each calculated attribute can only reference one ObjectType and at most, two fields from that ObjectType.

See also: AWS API Documentation

Request Syntax

response = client.create_calculated_attribute_definition(
    DomainName='string',
    CalculatedAttributeName='string',
    DisplayName='string',
    Description='string',
    AttributeDetails={
        'Attributes': [
            {
                'Name': 'string'
            },
        ],
        'Expression': 'string'
    },
    Conditions={
        'Range': {
            'Value': 123,
            'Unit': 'DAYS'
        },
        'ObjectCount': 123,
        'Threshold': {
            'Value': 'string',
            'Operator': 'EQUAL_TO'|'GREATER_THAN'|'LESS_THAN'|'NOT_EQUAL_TO'
        }
    },
    Filter={
        'Include': 'ALL'|'ANY'|'NONE',
        'Groups': [
            {
                'Type': 'ALL'|'ANY'|'NONE',
                'Dimensions': [
                    {
                        'Attributes': {
                            'string': {
                                'DimensionType': 'INCLUSIVE'|'EXCLUSIVE'|'CONTAINS'|'BEGINS_WITH'|'ENDS_WITH'|'BEFORE'|'AFTER'|'BETWEEN'|'NOT_BETWEEN'|'ON'|'GREATER_THAN'|'LESS_THAN'|'GREATER_THAN_OR_EQUAL'|'LESS_THAN_OR_EQUAL'|'EQUAL',
                                'Values': [
                                    'string',
                                ]
                            }
                        }
                    },
                ]
            },
        ]
    },
    Statistic='FIRST_OCCURRENCE'|'LAST_OCCURRENCE'|'COUNT'|'SUM'|'MINIMUM'|'MAXIMUM'|'AVERAGE'|'MAX_OCCURRENCE',
    Tags={
        'string': 'string'
    }
)
Parameters:
  • DomainName (string) –

    [REQUIRED]

    The unique name of the domain.

  • CalculatedAttributeName (string) –

    [REQUIRED]

    The unique name of the calculated attribute.

  • DisplayName (string) – The display name of the calculated attribute.

  • Description (string) – The description of the calculated attribute.

  • AttributeDetails (dict) –

    [REQUIRED]

    Mathematical expression and a list of attribute items specified in that expression.

    • Attributes (list) – [REQUIRED]

      A list of attribute items specified in the mathematical expression.

      • (dict) –

        The details of a single attribute item specified in the mathematical expression.

        • Name (string) – [REQUIRED]

          The name of an attribute defined in a profile object type.

    • Expression (string) – [REQUIRED]

      Mathematical expression that is performed on attribute items provided in the attribute list. Each element in the expression should follow the structure of "{ObjectTypeName.AttributeName}".

  • Conditions (dict) –

    The conditions including range, object count, and threshold for the calculated attribute.

    • Range (dict) –

      The relative time period over which data is included in the aggregation.

      • Value (integer) – [REQUIRED]

        The amount of time of the specified unit.

      • Unit (string) – [REQUIRED]

        The unit of time.

    • ObjectCount (integer) –

      The number of profile objects used for the calculated attribute.

    • Threshold (dict) –

      The threshold for the calculated attribute.

      • Value (string) – [REQUIRED]

        The value of the threshold.

      • Operator (string) – [REQUIRED]

        The operator of the threshold.

  • Filter (dict) –

    Defines how to filter incoming objects to include part of the Calculated Attribute.

    • Include (string) – [REQUIRED]

      Define whether to include or exclude objects for Calculated Attributed calculation that fit the filter groups criteria.

    • Groups (list) – [REQUIRED]

      Holds the list of Filter groups within the Filter definition.

      • (dict) –

        Object that holds the dimensions to filter on.

        • Type (string) – [REQUIRED]

          The type of logical relationship between the dimensions of the Filter group.

        • Dimensions (list) – [REQUIRED]

          Object that holds the attributes to filter on.

          • (dict) –

            Contains the map of attribute names to attribute dimensions.

            • Attributes (dict) – [REQUIRED]

              Is the attribute within the FilterDimension map

              • (string) –

                • (dict) –

                  Object that defines how to filter the incoming objects for the calculated attribute.

                  • DimensionType (string) – [REQUIRED]

                    The action to filter with.

                  • Values (list) – [REQUIRED]

                    The values to apply the DimensionType on.

                    • (string) –

  • Statistic (string) –

    [REQUIRED]

    The aggregation operation to perform for the calculated attribute.

  • Tags (dict) –

    The tags used to organize, track, or control access for this resource.

    • (string) –

      • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'CalculatedAttributeName': 'string',
    'DisplayName': 'string',
    'Description': 'string',
    'AttributeDetails': {
        'Attributes': [
            {
                'Name': 'string'
            },
        ],
        'Expression': 'string'
    },
    'Conditions': {
        'Range': {
            'Value': 123,
            'Unit': 'DAYS'
        },
        'ObjectCount': 123,
        'Threshold': {
            'Value': 'string',
            'Operator': 'EQUAL_TO'|'GREATER_THAN'|'LESS_THAN'|'NOT_EQUAL_TO'
        }
    },
    'Filter': {
        'Include': 'ALL'|'ANY'|'NONE',
        'Groups': [
            {
                'Type': 'ALL'|'ANY'|'NONE',
                'Dimensions': [
                    {
                        'Attributes': {
                            'string': {
                                'DimensionType': 'INCLUSIVE'|'EXCLUSIVE'|'CONTAINS'|'BEGINS_WITH'|'ENDS_WITH'|'BEFORE'|'AFTER'|'BETWEEN'|'NOT_BETWEEN'|'ON'|'GREATER_THAN'|'LESS_THAN'|'GREATER_THAN_OR_EQUAL'|'LESS_THAN_OR_EQUAL'|'EQUAL',
                                'Values': [
                                    'string',
                                ]
                            }
                        }
                    },
                ]
            },
        ]
    },
    'Statistic': 'FIRST_OCCURRENCE'|'LAST_OCCURRENCE'|'COUNT'|'SUM'|'MINIMUM'|'MAXIMUM'|'AVERAGE'|'MAX_OCCURRENCE',
    'CreatedAt': datetime(2015, 1, 1),
    'LastUpdatedAt': datetime(2015, 1, 1),
    'Tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) –

    • CalculatedAttributeName (string) –

      The unique name of the calculated attribute.

    • DisplayName (string) –

      The display name of the calculated attribute.

    • Description (string) –

      The description of the calculated attribute.

    • AttributeDetails (dict) –

      Mathematical expression and a list of attribute items specified in that expression.

      • Attributes (list) –

        A list of attribute items specified in the mathematical expression.

        • (dict) –

          The details of a single attribute item specified in the mathematical expression.

          • Name (string) –

            The name of an attribute defined in a profile object type.

      • Expression (string) –

        Mathematical expression that is performed on attribute items provided in the attribute list. Each element in the expression should follow the structure of "{ObjectTypeName.AttributeName}".

    • Conditions (dict) –

      The conditions including range, object count, and threshold for the calculated attribute.

      • Range (dict) –

        The relative time period over which data is included in the aggregation.

        • Value (integer) –

          The amount of time of the specified unit.

        • Unit (string) –

          The unit of time.

      • ObjectCount (integer) –

        The number of profile objects used for the calculated attribute.

      • Threshold (dict) –

        The threshold for the calculated attribute.

        • Value (string) –

          The value of the threshold.

        • Operator (string) –

          The operator of the threshold.

    • Filter (dict) –

      The filter that was used as part of the request.

      • Include (string) –

        Define whether to include or exclude objects for Calculated Attributed calculation that fit the filter groups criteria.

      • Groups (list) –

        Holds the list of Filter groups within the Filter definition.

        • (dict) –

          Object that holds the dimensions to filter on.

          • Type (string) –

            The type of logical relationship between the dimensions of the Filter group.

          • Dimensions (list) –

            Object that holds the attributes to filter on.

            • (dict) –

              Contains the map of attribute names to attribute dimensions.

              • Attributes (dict) –

                Is the attribute within the FilterDimension map

                • (string) –

                  • (dict) –

                    Object that defines how to filter the incoming objects for the calculated attribute.

                    • DimensionType (string) –

                      The action to filter with.

                    • Values (list) –

                      The values to apply the DimensionType on.

                      • (string) –

    • Statistic (string) –

      The aggregation operation to perform for the calculated attribute.

    • CreatedAt (datetime) –

      The timestamp of when the calculated attribute definition was created.

    • LastUpdatedAt (datetime) –

      The timestamp of when the calculated attribute definition was most recently edited.

    • Tags (dict) –

      The tags used to organize, track, or control access for this resource.

      • (string) –

        • (string) –

Exceptions

  • CustomerProfiles.Client.exceptions.BadRequestException

  • CustomerProfiles.Client.exceptions.ResourceNotFoundException

  • CustomerProfiles.Client.exceptions.AccessDeniedException

  • CustomerProfiles.Client.exceptions.ThrottlingException

  • CustomerProfiles.Client.exceptions.InternalServerException