calculated_attribute_definitions
Creates, updates, deletes, gets or lists a calculated_attribute_definitions resource.
Overview
| Name | calculated_attribute_definitions |
| Type | Resource |
| Id | aws.customer_profiles.calculated_attribute_definitions |
Fields
The following fields are returned by SELECT queries:
- get_calculated_attribute_definition
- list_calculated_attribute_definitions
| Name | Datatype | Description |
|---|---|---|
attribute_details | object | Mathematical expression and a list of attribute items specified in that expression. |
calculated_attribute_name | string | The unique name of the calculated attribute. (pattern: <code>^[a-zA-Z_][a-zA-Z_0-9-]*$</code>) |
conditions | object | The conditions including range, object count, and threshold for the calculated attribute. |
created_at | string (date-time) | The timestamp of when the calculated attribute definition was created. |
description | string | The description of the calculated attribute. |
display_name | string | The display name of the calculated attribute. (pattern: <code>^[a-zA-Z_][a-zA-Z_0-9-\s]*$</code>) |
filter | object | Defines how to filter the objects coming in for calculated attributes. |
last_updated_at | string (date-time) | The timestamp of when the calculated attribute definition was most recently edited. |
readiness | object | Information indicating if the Calculated Attribute is ready for use by confirming all historical data has been processed and reflected. |
statistic | string | The aggregation operation to perform for the calculated attribute. (FIRST_OCCURRENCE, LAST_OCCURRENCE, COUNT, SUM, MINIMUM, MAXIMUM, AVERAGE, MAX_OCCURRENCE) |
status | string | Status of the Calculated Attribute creation (whether all historical data has been indexed). (PREPARING, IN_PROGRESS, COMPLETED, FAILED) |
tags | object | The tags used to organize, track, or control access for this resource. |
use_historical_data | boolean | Whether historical data ingested before the Calculated Attribute was created should be included in calculations. |
| Name | Datatype | Description |
|---|---|---|
items | array | The list of calculated attribute definitions. |
next_token | string | The pagination token from the previous call to ListCalculatedAttributeDefinitions. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_calculated_attribute_definition | select | domain_name, calculated_attribute_name, region | Provides more information on a calculated attribute definition for Customer Profiles. | |
list_calculated_attribute_definitions | select | domain_name, region | next-token, max-results | Lists calculated attribute definitions for Customer Profiles |
create_calculated_attribute_definition | insert | domain_name, calculated_attribute_name, region, AttributeDetails | 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. | |
update_calculated_attribute_definition | update | domain_name, calculated_attribute_name, region | Updates an existing calculated attribute definition. When updating the Conditions, note that increasing the date range of a calculated attribute will not trigger inclusion of historical data greater than the current date range. | |
delete_calculated_attribute_definition | delete | domain_name, calculated_attribute_name, region | Deletes an existing calculated attribute definition. Note that deleting a default calculated attribute is possible, however once deleted, you will be unable to undo that action and will need to recreate it on your own using the CreateCalculatedAttributeDefinition API if you want it back. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
calculated_attribute_name | string | The unique name of the calculated attribute. |
domain_name | string | The unique name of the domain. |
region | string | AWS region (default: us-east-1) |
max-results | integer | The maximum number of calculated attribute definitions returned per page. |
next-token | string | The pagination token from the previous call to ListCalculatedAttributeDefinitions. |
SELECT examples
- get_calculated_attribute_definition
- list_calculated_attribute_definitions
Provides more information on a calculated attribute definition for Customer Profiles.
SELECT
attribute_details,
calculated_attribute_name,
conditions,
created_at,
description,
display_name,
filter,
last_updated_at,
readiness,
statistic,
status,
tags,
use_historical_data
FROM aws.customer_profiles.calculated_attribute_definitions
WHERE domain_name = '{{ domain_name }}' -- required
AND calculated_attribute_name = '{{ calculated_attribute_name }}' -- required
AND region = '{{ region }}' -- required
;
Lists calculated attribute definitions for Customer Profiles
SELECT
items,
next_token
FROM aws.customer_profiles.calculated_attribute_definitions
WHERE domain_name = '{{ domain_name }}' -- required
AND region = '{{ region }}' -- required
AND `next-token` = '{{ next-token }}'
AND `max-results` = '{{ max-results }}'
;
INSERT examples
- create_calculated_attribute_definition
- Manifest
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.
INSERT INTO aws.customer_profiles.calculated_attribute_definitions (
DisplayName,
Description,
AttributeDetails,
Conditions,
Filter,
Statistic,
UseHistoricalData,
Tags,
domain_name,
calculated_attribute_name,
region
)
SELECT
'{{ DisplayName }}',
'{{ Description }}',
'{{ AttributeDetails }}' /* required */,
'{{ Conditions }}',
'{{ Filter }}',
'{{ Statistic }}',
{{ UseHistoricalData }},
'{{ Tags }}',
'{{ domain_name }}',
'{{ calculated_attribute_name }}',
'{{ region }}'
RETURNING
attribute_details,
calculated_attribute_name,
conditions,
created_at,
description,
display_name,
filter,
last_updated_at,
readiness,
statistic,
status,
tags,
use_historical_data
;
# Description fields are for documentation purposes
- name: calculated_attribute_definitions
props:
- name: domain_name
value: "{{ domain_name }}"
description: Required parameter for the calculated_attribute_definitions resource.
- name: calculated_attribute_name
value: "{{ calculated_attribute_name }}"
description: Required parameter for the calculated_attribute_definitions resource.
- name: region
value: "{{ region }}"
description: Required parameter for the calculated_attribute_definitions resource.
- name: DisplayName
value: "{{ DisplayName }}"
- name: Description
value: "{{ Description }}"
- name: AttributeDetails
description: |
Mathematical expression and a list of attribute items specified in that expression.
value:
Attributes:
- Name: "{{ Name }}"
Expression: "{{ Expression }}"
- name: Conditions
description: |
The conditions including range, object count, and threshold for the calculated attribute.
value:
Range:
Value: {{ Value }}
Unit: "{{ Unit }}"
ValueRange:
Start: {{ Start }}
End: {{ End }}
TimestampSource: "{{ TimestampSource }}"
TimestampFormat: "{{ TimestampFormat }}"
ObjectCount: {{ ObjectCount }}
Threshold:
Value: "{{ Value }}"
Operator: "{{ Operator }}"
- name: Filter
description: |
Defines how to filter the objects coming in for calculated attributes.
value:
Include: "{{ Include }}"
Groups:
- Type: "{{ Type }}"
Dimensions: "{{ Dimensions }}"
- name: Statistic
value: "{{ Statistic }}"
valid_values: ['FIRST_OCCURRENCE', 'LAST_OCCURRENCE', 'COUNT', 'SUM', 'MINIMUM', 'MAXIMUM', 'AVERAGE', 'MAX_OCCURRENCE']
- name: UseHistoricalData
value: {{ UseHistoricalData }}
- name: Tags
value: "{{ Tags }}"
UPDATE examples
- update_calculated_attribute_definition
Updates an existing calculated attribute definition. When updating the Conditions, note that increasing the date range of a calculated attribute will not trigger inclusion of historical data greater than the current date range.
UPDATE aws.customer_profiles.calculated_attribute_definitions
SET
DisplayName = '{{ DisplayName }}',
Description = '{{ Description }}',
Conditions = '{{ Conditions }}'
WHERE
domain_name = '{{ domain_name }}' --required
AND calculated_attribute_name = '{{ calculated_attribute_name }}' --required
AND region = '{{ region }}' --required
RETURNING
attribute_details,
calculated_attribute_name,
conditions,
created_at,
description,
display_name,
last_updated_at,
readiness,
statistic,
status,
tags,
use_historical_data;
DELETE examples
- delete_calculated_attribute_definition
Deletes an existing calculated attribute definition. Note that deleting a default calculated attribute is possible, however once deleted, you will be unable to undo that action and will need to recreate it on your own using the CreateCalculatedAttributeDefinition API if you want it back.
DELETE FROM aws.customer_profiles.calculated_attribute_definitions
WHERE domain_name = '{{ domain_name }}' --required
AND calculated_attribute_name = '{{ calculated_attribute_name }}' --required
AND region = '{{ region }}' --required
;