SDK for PHP 3.x

Client: Aws\TimestreamQuery\TimestreamQueryClient
Service ID: timestream-query
Version: 2018-11-01

This page describes the parameters and results for the operations of the Amazon Timestream Query (2018-11-01), and shows how to use the Aws\TimestreamQuery\TimestreamQueryClient object to call the described operations. This documentation is specific to the 2018-11-01 API version of the service.

Operation Summary

Each of the following operations can be created from a client using $client->getCommand('CommandName'), where "CommandName" is the name of one of the following operations. Note: a command is a value that encapsulates an operation and the parameters used to create an HTTP request.

You can also create and send a command immediately using the magic methods available on a client object: $client->commandName(/* parameters */). You can send the command asynchronously (returning a promise) by appending the word "Async" to the operation name: $client->commandNameAsync(/* parameters */).

CancelQuery ( array $params = [] )
Cancels a query that has been issued.
CreateScheduledQuery ( array $params = [] )
Create a scheduled query that will be run on your behalf at the configured schedule.
DeleteScheduledQuery ( array $params = [] )
Deletes a given scheduled query.
DescribeAccountSettings ( array $params = [] )
Describes the settings for your account that include the query pricing model and the configured maximum TCUs the service can use for your query workload.
DescribeEndpoints ( array $params = [] )
DescribeEndpoints returns a list of available endpoints to make Timestream API calls against.
DescribeScheduledQuery ( array $params = [] )
Provides detailed information about a scheduled query.
ExecuteScheduledQuery ( array $params = [] )
You can use this API to run a scheduled query manually.
ListScheduledQueries ( array $params = [] )
Gets a list of all scheduled queries in the caller's Amazon account and Region.
ListTagsForResource ( array $params = [] )
List all tags on a Timestream query resource.
PrepareQuery ( array $params = [] )
A synchronous operation that allows you to submit a query with parameters to be stored by Timestream for later running.
Query ( array $params = [] )
Query is a synchronous operation that enables you to run a query against your Amazon Timestream data.
TagResource ( array $params = [] )
Associate a set of tags with a Timestream resource.
UntagResource ( array $params = [] )
Removes the association of tags from a Timestream query resource.
UpdateAccountSettings ( array $params = [] )
Transitions your account to use TCUs for query pricing and modifies the maximum query compute units that you've configured.
UpdateScheduledQuery ( array $params = [] )
Update a scheduled query.

Paginators

Paginators handle automatically iterating over paginated API results. Paginators are associated with specific API operations, and they accept the parameters that the corresponding API operation accepts. You can get a paginator from a client class using getPaginator($paginatorName, $operationParameters). This client supports the following paginators:

ListScheduledQueries
ListTagsForResource
Query

Operations

CancelQuery

$result = $client->cancelQuery([/* ... */]);
$promise = $client->cancelQueryAsync([/* ... */]);

Cancels a query that has been issued. Cancellation is provided only if the query has not completed running before the cancellation request was issued. Because cancellation is an idempotent operation, subsequent cancellation requests will return a CancellationMessage, indicating that the query has already been canceled. See code sample for details.

Parameter Syntax

$result = $client->cancelQuery([
    'QueryId' => '<string>', // REQUIRED
]);

Parameter Details

Members
QueryId
Required: Yes
Type: string

The ID of the query that needs to be cancelled. QueryID is returned as part of the query result.

Result Syntax

[
    'CancellationMessage' => '<string>',
]

Result Details

Members
CancellationMessage
Type: string

A CancellationMessage is returned when a CancelQuery request for the query specified by QueryId has already been issued.

Errors

AccessDeniedException:

You do not have the necessary permissions to access the account settings.

InternalServerException:

An internal server error occurred while processing the request.

ThrottlingException:

The request was throttled due to excessive requests.

ValidationException:

Invalid or malformed request.

InvalidEndpointException:

The requested endpoint is invalid.

CreateScheduledQuery

$result = $client->createScheduledQuery([/* ... */]);
$promise = $client->createScheduledQueryAsync([/* ... */]);

Create a scheduled query that will be run on your behalf at the configured schedule. Timestream assumes the execution role provided as part of the ScheduledQueryExecutionRoleArn parameter to run the query. You can use the NotificationConfiguration parameter to configure notification for your scheduled query operations.

Parameter Syntax

$result = $client->createScheduledQuery([
    'ClientToken' => '<string>',
    'ErrorReportConfiguration' => [ // REQUIRED
        'S3Configuration' => [ // REQUIRED
            'BucketName' => '<string>', // REQUIRED
            'EncryptionOption' => 'SSE_S3|SSE_KMS',
            'ObjectKeyPrefix' => '<string>',
        ],
    ],
    'KmsKeyId' => '<string>',
    'Name' => '<string>', // REQUIRED
    'NotificationConfiguration' => [ // REQUIRED
        'SnsConfiguration' => [ // REQUIRED
            'TopicArn' => '<string>', // REQUIRED
        ],
    ],
    'QueryString' => '<string>', // REQUIRED
    'ScheduleConfiguration' => [ // REQUIRED
        'ScheduleExpression' => '<string>', // REQUIRED
    ],
    'ScheduledQueryExecutionRoleArn' => '<string>', // REQUIRED
    'Tags' => [
        [
            'Key' => '<string>', // REQUIRED
            'Value' => '<string>', // REQUIRED
        ],
        // ...
    ],
    'TargetConfiguration' => [
        'TimestreamConfiguration' => [ // REQUIRED
            'DatabaseName' => '<string>', // REQUIRED
            'DimensionMappings' => [ // REQUIRED
                [
                    'DimensionValueType' => 'VARCHAR', // REQUIRED
                    'Name' => '<string>', // REQUIRED
                ],
                // ...
            ],
            'MeasureNameColumn' => '<string>',
            'MixedMeasureMappings' => [
                [
                    'MeasureName' => '<string>',
                    'MeasureValueType' => 'BIGINT|BOOLEAN|DOUBLE|VARCHAR|MULTI', // REQUIRED
                    'MultiMeasureAttributeMappings' => [
                        [
                            'MeasureValueType' => 'BIGINT|BOOLEAN|DOUBLE|VARCHAR|TIMESTAMP', // REQUIRED
                            'SourceColumn' => '<string>', // REQUIRED
                            'TargetMultiMeasureAttributeName' => '<string>',
                        ],
                        // ...
                    ],
                    'SourceColumn' => '<string>',
                    'TargetMeasureName' => '<string>',
                ],
                // ...
            ],
            'MultiMeasureMappings' => [
                'MultiMeasureAttributeMappings' => [ // REQUIRED
                    [
                        'MeasureValueType' => 'BIGINT|BOOLEAN|DOUBLE|VARCHAR|TIMESTAMP', // REQUIRED
                        'SourceColumn' => '<string>', // REQUIRED
                        'TargetMultiMeasureAttributeName' => '<string>',
                    ],
                    // ...
                ],
                'TargetMultiMeasureName' => '<string>',
            ],
            'TableName' => '<string>', // REQUIRED
            'TimeColumn' => '<string>', // REQUIRED
        ],
    ],
]);

Parameter Details

Members
ClientToken
Type: string

Using a ClientToken makes the call to CreateScheduledQuery idempotent, in other words, making the same request repeatedly will produce the same result. Making multiple identical CreateScheduledQuery requests has the same effect as making a single request.

  • If CreateScheduledQuery is called without a ClientToken, the Query SDK generates a ClientToken on your behalf.

  • After 8 hours, any request with the same ClientToken is treated as a new request.

ErrorReportConfiguration
Required: Yes
Type: ErrorReportConfiguration structure

Configuration for error reporting. Error reports will be generated when a problem is encountered when writing the query results.

KmsKeyId
Type: string

The Amazon KMS key used to encrypt the scheduled query resource, at-rest. If the Amazon KMS key is not specified, the scheduled query resource will be encrypted with a Timestream owned Amazon KMS key. To specify a KMS key, use the key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix the name with alias/

If ErrorReportConfiguration uses SSE_KMS as encryption type, the same KmsKeyId is used to encrypt the error report at rest.

Name
Required: Yes
Type: string

Name of the scheduled query.

NotificationConfiguration
Required: Yes
Type: NotificationConfiguration structure

Notification configuration for the scheduled query. A notification is sent by Timestream when a query run finishes, when the state is updated or when you delete it.

QueryString
Required: Yes
Type: string

The query string to run. Parameter names can be specified in the query string @ character followed by an identifier. The named Parameter @scheduled_runtime is reserved and can be used in the query to get the time at which the query is scheduled to run.

The timestamp calculated according to the ScheduleConfiguration parameter, will be the value of @scheduled_runtime paramater for each query run. For example, consider an instance of a scheduled query executing on 2021-12-01 00:00:00. For this instance, the @scheduled_runtime parameter is initialized to the timestamp 2021-12-01 00:00:00 when invoking the query.

ScheduleConfiguration
Required: Yes
Type: ScheduleConfiguration structure

The schedule configuration for the query.

ScheduledQueryExecutionRoleArn
Required: Yes
Type: string

The ARN for the IAM role that Timestream will assume when running the scheduled query.

Tags
Type: Array of Tag structures

A list of key-value pairs to label the scheduled query.

TargetConfiguration
Type: TargetConfiguration structure

Configuration used for writing the result of a query.

Result Syntax

[
    'Arn' => '<string>',
]

Result Details

Members
Arn
Required: Yes
Type: string

ARN for the created scheduled query.

Errors

AccessDeniedException:

You do not have the necessary permissions to access the account settings.

ConflictException:

Unable to poll results for a cancelled query.

InternalServerException:

An internal server error occurred while processing the request.

ServiceQuotaExceededException:

You have exceeded the service quota.

ThrottlingException:

The request was throttled due to excessive requests.

ValidationException:

Invalid or malformed request.

InvalidEndpointException:

The requested endpoint is invalid.

DeleteScheduledQuery

$result = $client->deleteScheduledQuery([/* ... */]);
$promise = $client->deleteScheduledQueryAsync([/* ... */]);

Deletes a given scheduled query. This is an irreversible operation.

Parameter Syntax

$result = $client->deleteScheduledQuery([
    'ScheduledQueryArn' => '<string>', // REQUIRED
]);

Parameter Details

Members
ScheduledQueryArn
Required: Yes
Type: string

The ARN of the scheduled query.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

AccessDeniedException:

You do not have the necessary permissions to access the account settings.

InternalServerException:

An internal server error occurred while processing the request.

ResourceNotFoundException:

The requested resource could not be found.

ThrottlingException:

The request was throttled due to excessive requests.

ValidationException:

Invalid or malformed request.

InvalidEndpointException:

The requested endpoint is invalid.

DescribeAccountSettings

$result = $client->describeAccountSettings([/* ... */]);
$promise = $client->describeAccountSettingsAsync([/* ... */]);

Describes the settings for your account that include the query pricing model and the configured maximum TCUs the service can use for your query workload.

You're charged only for the duration of compute units used for your workloads.

Parameter Syntax

$result = $client->describeAccountSettings([
]);

Parameter Details

Members

Result Syntax

[
    'MaxQueryTCU' => <integer>,
    'QueryCompute' => [
        'ComputeMode' => 'ON_DEMAND|PROVISIONED',
        'ProvisionedCapacity' => [
            'ActiveQueryTCU' => <integer>,
            'LastUpdate' => [
                'Status' => 'PENDING|FAILED|SUCCEEDED',
                'StatusMessage' => '<string>',
                'TargetQueryTCU' => <integer>,
            ],
            'NotificationConfiguration' => [
                'RoleArn' => '<string>',
                'SnsConfiguration' => [
                    'TopicArn' => '<string>',
                ],
            ],
        ],
    ],
    'QueryPricingModel' => 'BYTES_SCANNED|COMPUTE_UNITS',
]

Result Details

Members
MaxQueryTCU
Type: int

The maximum number of Timestream compute units (TCUs) the service will use at any point in time to serve your queries. To run queries, you must set a minimum capacity of 4 TCU. You can set the maximum number of TCU in multiples of 4, for example, 4, 8, 16, 32, and so on. This configuration is applicable only for on-demand usage of (TCUs).

QueryCompute
Type: QueryComputeResponse structure

An object that contains the usage settings for Timestream Compute Units (TCUs) in your account for the query workload.

QueryPricingModel
Type: string

The pricing model for queries in your account.

The QueryPricingModel parameter is used by several Timestream operations; however, the UpdateAccountSettings API operation doesn't recognize any values other than COMPUTE_UNITS.

Errors

AccessDeniedException:

You do not have the necessary permissions to access the account settings.

InternalServerException:

An internal server error occurred while processing the request.

ThrottlingException:

The request was throttled due to excessive requests.

InvalidEndpointException:

The requested endpoint is invalid.

DescribeEndpoints

$result = $client->describeEndpoints([/* ... */]);
$promise = $client->describeEndpointsAsync([/* ... */]);

DescribeEndpoints returns a list of available endpoints to make Timestream API calls against. This API is available through both Write and Query.

Because the Timestream SDKs are designed to transparently work with the service’s architecture, including the management and mapping of the service endpoints, it is not recommended that you use this API unless:

For detailed information on how and when to use and implement DescribeEndpoints, see The Endpoint Discovery Pattern.

Parameter Syntax

$result = $client->describeEndpoints([
]);

Parameter Details

Members

Result Syntax

[
    'Endpoints' => [
        [
            'Address' => '<string>',
            'CachePeriodInMinutes' => <integer>,
        ],
        // ...
    ],
]

Result Details

Members
Endpoints
Required: Yes
Type: Array of Endpoint structures

An Endpoints object is returned when a DescribeEndpoints request is made.

Errors

InternalServerException:

An internal server error occurred while processing the request.

ValidationException:

Invalid or malformed request.

ThrottlingException:

The request was throttled due to excessive requests.

DescribeScheduledQuery

$result = $client->describeScheduledQuery([/* ... */]);
$promise = $client->describeScheduledQueryAsync([/* ... */]);

Provides detailed information about a scheduled query.

Parameter Syntax

$result = $client->describeScheduledQuery([
    'ScheduledQueryArn' => '<string>', // REQUIRED
]);

Parameter Details

Members
ScheduledQueryArn
Required: Yes
Type: string

The ARN of the scheduled query.

Result Syntax

[
    'ScheduledQuery' => [
        'Arn' => '<string>',
        'CreationTime' => <DateTime>,
        'ErrorReportConfiguration' => [
            'S3Configuration' => [
                'BucketName' => '<string>',
                'EncryptionOption' => 'SSE_S3|SSE_KMS',
                'ObjectKeyPrefix' => '<string>',
            ],
        ],
        'KmsKeyId' => '<string>',
        'LastRunSummary' => [
            'ErrorReportLocation' => [
                'S3ReportLocation' => [
                    'BucketName' => '<string>',
                    'ObjectKey' => '<string>',
                ],
            ],
            'ExecutionStats' => [
                'BytesMetered' => <integer>,
                'CumulativeBytesScanned' => <integer>,
                'DataWrites' => <integer>,
                'ExecutionTimeInMillis' => <integer>,
                'QueryResultRows' => <integer>,
                'RecordsIngested' => <integer>,
            ],
            'FailureReason' => '<string>',
            'InvocationTime' => <DateTime>,
            'QueryInsightsResponse' => [
                'OutputBytes' => <integer>,
                'OutputRows' => <integer>,
                'QuerySpatialCoverage' => [
                    'Max' => [
                        'PartitionKey' => ['<string>', ...],
                        'TableArn' => '<string>',
                        'Value' => <float>,
                    ],
                ],
                'QueryTableCount' => <integer>,
                'QueryTemporalRange' => [
                    'Max' => [
                        'TableArn' => '<string>',
                        'Value' => <integer>,
                    ],
                ],
            ],
            'RunStatus' => 'AUTO_TRIGGER_SUCCESS|AUTO_TRIGGER_FAILURE|MANUAL_TRIGGER_SUCCESS|MANUAL_TRIGGER_FAILURE',
            'TriggerTime' => <DateTime>,
        ],
        'Name' => '<string>',
        'NextInvocationTime' => <DateTime>,
        'NotificationConfiguration' => [
            'SnsConfiguration' => [
                'TopicArn' => '<string>',
            ],
        ],
        'PreviousInvocationTime' => <DateTime>,
        'QueryString' => '<string>',
        'RecentlyFailedRuns' => [
            [
                'ErrorReportLocation' => [
                    'S3ReportLocation' => [
                        'BucketName' => '<string>',
                        'ObjectKey' => '<string>',
                    ],
                ],
                'ExecutionStats' => [
                    'BytesMetered' => <integer>,
                    'CumulativeBytesScanned' => <integer>,
                    'DataWrites' => <integer>,
                    'ExecutionTimeInMillis' => <integer>,
                    'QueryResultRows' => <integer>,
                    'RecordsIngested' => <integer>,
                ],
                'FailureReason' => '<string>',
                'InvocationTime' => <DateTime>,
                'QueryInsightsResponse' => [
                    'OutputBytes' => <integer>,
                    'OutputRows' => <integer>,
                    'QuerySpatialCoverage' => [
                        'Max' => [
                            'PartitionKey' => ['<string>', ...],
                            'TableArn' => '<string>',
                            'Value' => <float>,
                        ],
                    ],
                    'QueryTableCount' => <integer>,
                    'QueryTemporalRange' => [
                        'Max' => [
                            'TableArn' => '<string>',
                            'Value' => <integer>,
                        ],
                    ],
                ],
                'RunStatus' => 'AUTO_TRIGGER_SUCCESS|AUTO_TRIGGER_FAILURE|MANUAL_TRIGGER_SUCCESS|MANUAL_TRIGGER_FAILURE',
                'TriggerTime' => <DateTime>,
            ],
            // ...
        ],
        'ScheduleConfiguration' => [
            'ScheduleExpression' => '<string>',
        ],
        'ScheduledQueryExecutionRoleArn' => '<string>',
        'State' => 'ENABLED|DISABLED',
        'TargetConfiguration' => [
            'TimestreamConfiguration' => [
                'DatabaseName' => '<string>',
                'DimensionMappings' => [
                    [
                        'DimensionValueType' => 'VARCHAR',
                        'Name' => '<string>',
                    ],
                    // ...
                ],
                'MeasureNameColumn' => '<string>',
                'MixedMeasureMappings' => [
                    [
                        'MeasureName' => '<string>',
                        'MeasureValueType' => 'BIGINT|BOOLEAN|DOUBLE|VARCHAR|MULTI',
                        'MultiMeasureAttributeMappings' => [
                            [
                                'MeasureValueType' => 'BIGINT|BOOLEAN|DOUBLE|VARCHAR|TIMESTAMP',
                                'SourceColumn' => '<string>',
                                'TargetMultiMeasureAttributeName' => '<string>',
                            ],
                            // ...
                        ],
                        'SourceColumn' => '<string>',
                        'TargetMeasureName' => '<string>',
                    ],
                    // ...
                ],
                'MultiMeasureMappings' => [
                    'MultiMeasureAttributeMappings' => [
                        [
                            'MeasureValueType' => 'BIGINT|BOOLEAN|DOUBLE|VARCHAR|TIMESTAMP',
                            'SourceColumn' => '<string>',
                            'TargetMultiMeasureAttributeName' => '<string>',
                        ],
                        // ...
                    ],
                    'TargetMultiMeasureName' => '<string>',
                ],
                'TableName' => '<string>',
                'TimeColumn' => '<string>',
            ],
        ],
    ],
]

Result Details

Members
ScheduledQuery
Required: Yes
Type: ScheduledQueryDescription structure

The scheduled query.

Errors

AccessDeniedException:

You do not have the necessary permissions to access the account settings.

InternalServerException:

An internal server error occurred while processing the request.

ResourceNotFoundException:

The requested resource could not be found.

ThrottlingException:

The request was throttled due to excessive requests.

ValidationException:

Invalid or malformed request.

InvalidEndpointException:

The requested endpoint is invalid.

ExecuteScheduledQuery

$result = $client->executeScheduledQuery([/* ... */]);
$promise = $client->executeScheduledQueryAsync([/* ... */]);

You can use this API to run a scheduled query manually.

If you enabled QueryInsights, this API also returns insights and metrics related to the query that you executed as part of an Amazon SNS notification. QueryInsights helps with performance tuning of your query. For more information about QueryInsights, see Using query insights to optimize queries in Amazon Timestream.

Parameter Syntax

$result = $client->executeScheduledQuery([
    'ClientToken' => '<string>',
    'InvocationTime' => <integer || string || DateTime>, // REQUIRED
    'QueryInsights' => [
        'Mode' => 'ENABLED_WITH_RATE_CONTROL|DISABLED', // REQUIRED
    ],
    'ScheduledQueryArn' => '<string>', // REQUIRED
]);

Parameter Details

Members
ClientToken
Type: string

Not used.

InvocationTime
Required: Yes
Type: timestamp (string|DateTime or anything parsable by strtotime)

The timestamp in UTC. Query will be run as if it was invoked at this timestamp.

QueryInsights
Type: ScheduledQueryInsights structure

Encapsulates settings for enabling QueryInsights.

Enabling QueryInsights returns insights and metrics as a part of the Amazon SNS notification for the query that you executed. You can use QueryInsights to tune your query performance and cost.

ScheduledQueryArn
Required: Yes
Type: string

ARN of the scheduled query.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

AccessDeniedException:

You do not have the necessary permissions to access the account settings.

InternalServerException:

An internal server error occurred while processing the request.

ResourceNotFoundException:

The requested resource could not be found.

ThrottlingException:

The request was throttled due to excessive requests.

ValidationException:

Invalid or malformed request.

InvalidEndpointException:

The requested endpoint is invalid.

ListScheduledQueries

$result = $client->listScheduledQueries([/* ... */]);
$promise = $client->listScheduledQueriesAsync([/* ... */]);

Gets a list of all scheduled queries in the caller's Amazon account and Region. ListScheduledQueries is eventually consistent.

Parameter Syntax

$result = $client->listScheduledQueries([
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
]);

Parameter Details

Members
MaxResults
Type: int

The maximum number of items to return in the output. If the total number of items available is more than the value specified, a NextToken is provided in the output. To resume pagination, provide the NextToken value as the argument to the subsequent call to ListScheduledQueriesRequest.

NextToken
Type: string

A pagination token to resume pagination.

Result Syntax

[
    'NextToken' => '<string>',
    'ScheduledQueries' => [
        [
            'Arn' => '<string>',
            'CreationTime' => <DateTime>,
            'ErrorReportConfiguration' => [
                'S3Configuration' => [
                    'BucketName' => '<string>',
                    'EncryptionOption' => 'SSE_S3|SSE_KMS',
                    'ObjectKeyPrefix' => '<string>',
                ],
            ],
            'LastRunStatus' => 'AUTO_TRIGGER_SUCCESS|AUTO_TRIGGER_FAILURE|MANUAL_TRIGGER_SUCCESS|MANUAL_TRIGGER_FAILURE',
            'Name' => '<string>',
            'NextInvocationTime' => <DateTime>,
            'PreviousInvocationTime' => <DateTime>,
            'State' => 'ENABLED|DISABLED',
            'TargetDestination' => [
                'TimestreamDestination' => [
                    'DatabaseName' => '<string>',
                    'TableName' => '<string>',
                ],
            ],
        ],
        // ...
    ],
]

Result Details

Members
NextToken
Type: string

A token to specify where to start paginating. This is the NextToken from a previously truncated response.

ScheduledQueries
Required: Yes
Type: Array of ScheduledQuery structures

A list of scheduled queries.

Errors

AccessDeniedException:

You do not have the necessary permissions to access the account settings.

InternalServerException:

An internal server error occurred while processing the request.

ThrottlingException:

The request was throttled due to excessive requests.

ValidationException:

Invalid or malformed request.

InvalidEndpointException:

The requested endpoint is invalid.

ListTagsForResource

$result = $client->listTagsForResource([/* ... */]);
$promise = $client->listTagsForResourceAsync([/* ... */]);

List all tags on a Timestream query resource.

Parameter Syntax

$result = $client->listTagsForResource([
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'ResourceARN' => '<string>', // REQUIRED
]);

Parameter Details

Members
MaxResults
Type: int

The maximum number of tags to return.

NextToken
Type: string

A pagination token to resume pagination.

ResourceARN
Required: Yes
Type: string

The Timestream resource with tags to be listed. This value is an Amazon Resource Name (ARN).

Result Syntax

[
    'NextToken' => '<string>',
    'Tags' => [
        [
            'Key' => '<string>',
            'Value' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
NextToken
Type: string

A pagination token to resume pagination with a subsequent call to ListTagsForResourceResponse.

Tags
Required: Yes
Type: Array of Tag structures

The tags currently associated with the Timestream resource.

Errors

ResourceNotFoundException:

The requested resource could not be found.

ThrottlingException:

The request was throttled due to excessive requests.

ValidationException:

Invalid or malformed request.

InvalidEndpointException:

The requested endpoint is invalid.

PrepareQuery

$result = $client->prepareQuery([/* ... */]);
$promise = $client->prepareQueryAsync([/* ... */]);

A synchronous operation that allows you to submit a query with parameters to be stored by Timestream for later running. Timestream only supports using this operation with ValidateOnly set to true.

Parameter Syntax

$result = $client->prepareQuery([
    'QueryString' => '<string>', // REQUIRED
    'ValidateOnly' => true || false,
]);

Parameter Details

Members
QueryString
Required: Yes
Type: string

The Timestream query string that you want to use as a prepared statement. Parameter names can be specified in the query string @ character followed by an identifier.

ValidateOnly
Type: boolean

By setting this value to true, Timestream will only validate that the query string is a valid Timestream query, and not store the prepared query for later use.

Result Syntax

[
    'Columns' => [
        [
            'Aliased' => true || false,
            'DatabaseName' => '<string>',
            'Name' => '<string>',
            'TableName' => '<string>',
            'Type' => [
                'ArrayColumnInfo' => [
                    'Name' => '<string>',
                    'Type' => [...], // RECURSIVE
                ],
                'RowColumnInfo' => [
                    [
                        'Name' => '<string>',
                        'Type' => [...], // RECURSIVE
                    ],
                    // ...
                ],
                'ScalarType' => 'VARCHAR|BOOLEAN|BIGINT|DOUBLE|TIMESTAMP|DATE|TIME|INTERVAL_DAY_TO_SECOND|INTERVAL_YEAR_TO_MONTH|UNKNOWN|INTEGER',
                'TimeSeriesMeasureValueColumnInfo' => [
                    'Name' => '<string>',
                    'Type' => [...], // RECURSIVE
                ],
            ],
        ],
        // ...
    ],
    'Parameters' => [
        [
            'Name' => '<string>',
            'Type' => [
                'ArrayColumnInfo' => [
                    'Name' => '<string>',
                    'Type' => [...], // RECURSIVE
                ],
                'RowColumnInfo' => [
                    [
                        'Name' => '<string>',
                        'Type' => [...], // RECURSIVE
                    ],
                    // ...
                ],
                'ScalarType' => 'VARCHAR|BOOLEAN|BIGINT|DOUBLE|TIMESTAMP|DATE|TIME|INTERVAL_DAY_TO_SECOND|INTERVAL_YEAR_TO_MONTH|UNKNOWN|INTEGER',
                'TimeSeriesMeasureValueColumnInfo' => [
                    'Name' => '<string>',
                    'Type' => [...], // RECURSIVE
                ],
            ],
        ],
        // ...
    ],
    'QueryString' => '<string>',
]

Result Details

Members
Columns
Required: Yes
Type: Array of SelectColumn structures

A list of SELECT clause columns of the submitted query string.

Parameters
Required: Yes
Type: Array of ParameterMapping structures

A list of parameters used in the submitted query string.

QueryString
Required: Yes
Type: string

The query string that you want prepare.

Errors

AccessDeniedException:

You do not have the necessary permissions to access the account settings.

InternalServerException:

An internal server error occurred while processing the request.

ThrottlingException:

The request was throttled due to excessive requests.

ValidationException:

Invalid or malformed request.

InvalidEndpointException:

The requested endpoint is invalid.

Query

$result = $client->query([/* ... */]);
$promise = $client->queryAsync([/* ... */]);

Query is a synchronous operation that enables you to run a query against your Amazon Timestream data.

If you enabled QueryInsights, this API also returns insights and metrics related to the query that you executed. QueryInsights helps with performance tuning of your query. For more information about QueryInsights, see Using query insights to optimize queries in Amazon Timestream.

The maximum number of Query API requests you're allowed to make with QueryInsights enabled is 1 query per second (QPS). If you exceed this query rate, it might result in throttling.

Query will time out after 60 seconds. You must update the default timeout in the SDK to support a timeout of 60 seconds. See the code sample for details.

Your query request will fail in the following cases:

  • If you submit a Query request with the same client token outside of the 5-minute idempotency window.

  • If you submit a Query request with the same client token, but change other parameters, within the 5-minute idempotency window.

  • If the size of the row (including the query metadata) exceeds 1 MB, then the query will fail with the following error message:

    Query aborted as max page response size has been exceeded by the output result row

  • If the IAM principal of the query initiator and the result reader are not the same and/or the query initiator and the result reader do not have the same query string in the query requests, the query will fail with an Invalid pagination token error.

Parameter Syntax

$result = $client->query([
    'ClientToken' => '<string>',
    'MaxRows' => <integer>,
    'NextToken' => '<string>',
    'QueryInsights' => [
        'Mode' => 'ENABLED_WITH_RATE_CONTROL|DISABLED', // REQUIRED
    ],
    'QueryString' => '<string>', // REQUIRED
]);

Parameter Details

Members
ClientToken
Type: string

Unique, case-sensitive string of up to 64 ASCII characters specified when a Query request is made. Providing a ClientToken makes the call to Query idempotent. This means that running the same query repeatedly will produce the same result. In other words, making multiple identical Query requests has the same effect as making a single request. When using ClientToken in a query, note the following:

  • If the Query API is instantiated without a ClientToken, the Query SDK generates a ClientToken on your behalf.

  • If the Query invocation only contains the ClientToken but does not include a NextToken, that invocation of Query is assumed to be a new query run.

  • If the invocation contains NextToken, that particular invocation is assumed to be a subsequent invocation of a prior call to the Query API, and a result set is returned.

  • After 4 hours, any request with the same ClientToken is treated as a new request.

MaxRows
Type: int

The total number of rows to be returned in the Query output. The initial run of Query with a MaxRows value specified will return the result set of the query in two cases:

  • The size of the result is less than 1MB.

  • The number of rows in the result set is less than the value of maxRows.

Otherwise, the initial invocation of Query only returns a NextToken, which can then be used in subsequent calls to fetch the result set. To resume pagination, provide the NextToken value in the subsequent command.

If the row size is large (e.g. a row has many columns), Timestream may return fewer rows to keep the response size from exceeding the 1 MB limit. If MaxRows is not provided, Timestream will send the necessary number of rows to meet the 1 MB limit.

NextToken
Type: string

A pagination token used to return a set of results. When the Query API is invoked using NextToken, that particular invocation is assumed to be a subsequent invocation of a prior call to Query, and a result set is returned. However, if the Query invocation only contains the ClientToken, that invocation of Query is assumed to be a new query run.

Note the following when using NextToken in a query:

  • A pagination token can be used for up to five Query invocations, OR for a duration of up to 1 hour – whichever comes first.

  • Using the same NextToken will return the same set of records. To keep paginating through the result set, you must to use the most recent nextToken.

  • Suppose a Query invocation returns two NextToken values, TokenA and TokenB. If TokenB is used in a subsequent Query invocation, then TokenA is invalidated and cannot be reused.

  • To request a previous result set from a query after pagination has begun, you must re-invoke the Query API.

  • The latest NextToken should be used to paginate until null is returned, at which point a new NextToken should be used.

  • If the IAM principal of the query initiator and the result reader are not the same and/or the query initiator and the result reader do not have the same query string in the query requests, the query will fail with an Invalid pagination token error.

QueryInsights
Type: QueryInsights structure

Encapsulates settings for enabling QueryInsights.

Enabling QueryInsights returns insights and metrics in addition to query results for the query that you executed. You can use QueryInsights to tune your query performance.

QueryString
Required: Yes
Type: string

The query to be run by Timestream.

Result Syntax

[
    'ColumnInfo' => [
        [
            'Name' => '<string>',
            'Type' => [
                'ArrayColumnInfo' => [...], // RECURSIVE
                'RowColumnInfo' => [...], // RECURSIVE
                'ScalarType' => 'VARCHAR|BOOLEAN|BIGINT|DOUBLE|TIMESTAMP|DATE|TIME|INTERVAL_DAY_TO_SECOND|INTERVAL_YEAR_TO_MONTH|UNKNOWN|INTEGER',
                'TimeSeriesMeasureValueColumnInfo' => [...], // RECURSIVE
            ],
        ],
        // ...
    ],
    'NextToken' => '<string>',
    'QueryId' => '<string>',
    'QueryInsightsResponse' => [
        'OutputBytes' => <integer>,
        'OutputRows' => <integer>,
        'QuerySpatialCoverage' => [
            'Max' => [
                'PartitionKey' => ['<string>', ...],
                'TableArn' => '<string>',
                'Value' => <float>,
            ],
        ],
        'QueryTableCount' => <integer>,
        'QueryTemporalRange' => [
            'Max' => [
                'TableArn' => '<string>',
                'Value' => <integer>,
            ],
        ],
        'UnloadPartitionCount' => <integer>,
        'UnloadWrittenBytes' => <integer>,
        'UnloadWrittenRows' => <integer>,
    ],
    'QueryStatus' => [
        'CumulativeBytesMetered' => <integer>,
        'CumulativeBytesScanned' => <integer>,
        'ProgressPercentage' => <float>,
    ],
    'Rows' => [
        [
            'Data' => [
                [
                    'ArrayValue' => [...], // RECURSIVE
                    'NullValue' => true || false,
                    'RowValue' => [...], // RECURSIVE
                    'ScalarValue' => '<string>',
                    'TimeSeriesValue' => [
                        [
                            'Time' => '<string>',
                            'Value' => [...], // RECURSIVE
                        ],
                        // ...
                    ],
                ],
                // ...
            ],
        ],
        // ...
    ],
]

Result Details

Members
ColumnInfo
Required: Yes
Type: Array of ColumnInfo structures

The column data types of the returned result set.

NextToken
Type: string

A pagination token that can be used again on a Query call to get the next set of results.

QueryId
Required: Yes
Type: string

A unique ID for the given query.

QueryInsightsResponse
Type: QueryInsightsResponse structure

Encapsulates QueryInsights containing insights and metrics related to the query that you executed.

QueryStatus
Type: QueryStatus structure

Information about the status of the query, including progress and bytes scanned.

Rows
Required: Yes
Type: Array of Row structures

The result set rows returned by the query.

Errors

AccessDeniedException:

You do not have the necessary permissions to access the account settings.

ConflictException:

Unable to poll results for a cancelled query.

InternalServerException:

An internal server error occurred while processing the request.

QueryExecutionException:

Timestream was unable to run the query successfully.

ThrottlingException:

The request was throttled due to excessive requests.

ValidationException:

Invalid or malformed request.

InvalidEndpointException:

The requested endpoint is invalid.

TagResource

$result = $client->tagResource([/* ... */]);
$promise = $client->tagResourceAsync([/* ... */]);

Associate a set of tags with a Timestream resource. You can then activate these user-defined tags so that they appear on the Billing and Cost Management console for cost allocation tracking.

Parameter Syntax

$result = $client->tagResource([
    'ResourceARN' => '<string>', // REQUIRED
    'Tags' => [ // REQUIRED
        [
            'Key' => '<string>', // REQUIRED
            'Value' => '<string>', // REQUIRED
        ],
        // ...
    ],
]);

Parameter Details

Members
ResourceARN
Required: Yes
Type: string

Identifies the Timestream resource to which tags should be added. This value is an Amazon Resource Name (ARN).

Tags
Required: Yes
Type: Array of Tag structures

The tags to be assigned to the Timestream resource.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

The requested resource could not be found.

ServiceQuotaExceededException:

You have exceeded the service quota.

ThrottlingException:

The request was throttled due to excessive requests.

ValidationException:

Invalid or malformed request.

InvalidEndpointException:

The requested endpoint is invalid.

UntagResource

$result = $client->untagResource([/* ... */]);
$promise = $client->untagResourceAsync([/* ... */]);

Removes the association of tags from a Timestream query resource.

Parameter Syntax

$result = $client->untagResource([
    'ResourceARN' => '<string>', // REQUIRED
    'TagKeys' => ['<string>', ...], // REQUIRED
]);

Parameter Details

Members
ResourceARN
Required: Yes
Type: string

The Timestream resource that the tags will be removed from. This value is an Amazon Resource Name (ARN).

TagKeys
Required: Yes
Type: Array of strings

A list of tags keys. Existing tags of the resource whose keys are members of this list will be removed from the Timestream resource.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ValidationException:

Invalid or malformed request.

ThrottlingException:

The request was throttled due to excessive requests.

ResourceNotFoundException:

The requested resource could not be found.

InvalidEndpointException:

The requested endpoint is invalid.

UpdateAccountSettings

$result = $client->updateAccountSettings([/* ... */]);
$promise = $client->updateAccountSettingsAsync([/* ... */]);

Transitions your account to use TCUs for query pricing and modifies the maximum query compute units that you've configured. If you reduce the value of MaxQueryTCU to a desired configuration, the new value can take up to 24 hours to be effective.

After you've transitioned your account to use TCUs for query pricing, you can't transition to using bytes scanned for query pricing.

Parameter Syntax

$result = $client->updateAccountSettings([
    'MaxQueryTCU' => <integer>,
    'QueryCompute' => [
        'ComputeMode' => 'ON_DEMAND|PROVISIONED',
        'ProvisionedCapacity' => [
            'NotificationConfiguration' => [
                'RoleArn' => '<string>', // REQUIRED
                'SnsConfiguration' => [
                    'TopicArn' => '<string>', // REQUIRED
                ],
            ],
            'TargetQueryTCU' => <integer>, // REQUIRED
        ],
    ],
    'QueryPricingModel' => 'BYTES_SCANNED|COMPUTE_UNITS',
]);

Parameter Details

Members
MaxQueryTCU
Type: int

The maximum number of compute units the service will use at any point in time to serve your queries. To run queries, you must set a minimum capacity of 4 TCU. You can set the maximum number of TCU in multiples of 4, for example, 4, 8, 16, 32, and so on. The maximum value supported for MaxQueryTCU is 1000. To request an increase to this soft limit, contact Amazon Web Services Support. For information about the default quota for maxQueryTCU, see Default quotas. This configuration is applicable only for on-demand usage of Timestream Compute Units (TCUs).

The maximum value supported for MaxQueryTCU is 1000. To request an increase to this soft limit, contact Amazon Web Services Support. For information about the default quota for maxQueryTCU, see Default quotas.

QueryCompute
Type: QueryComputeRequest structure

Modifies the query compute settings configured in your account, including the query pricing model and provisioned Timestream Compute Units (TCUs) in your account.

This API is idempotent, meaning that making the same request multiple times will have the same effect as making the request once.

QueryPricingModel
Type: string

The pricing model for queries in an account.

The QueryPricingModel parameter is used by several Timestream operations; however, the UpdateAccountSettings API operation doesn't recognize any values other than COMPUTE_UNITS.

Result Syntax

[
    'MaxQueryTCU' => <integer>,
    'QueryCompute' => [
        'ComputeMode' => 'ON_DEMAND|PROVISIONED',
        'ProvisionedCapacity' => [
            'ActiveQueryTCU' => <integer>,
            'LastUpdate' => [
                'Status' => 'PENDING|FAILED|SUCCEEDED',
                'StatusMessage' => '<string>',
                'TargetQueryTCU' => <integer>,
            ],
            'NotificationConfiguration' => [
                'RoleArn' => '<string>',
                'SnsConfiguration' => [
                    'TopicArn' => '<string>',
                ],
            ],
        ],
    ],
    'QueryPricingModel' => 'BYTES_SCANNED|COMPUTE_UNITS',
]

Result Details

Members
MaxQueryTCU
Type: int

The configured maximum number of compute units the service will use at any point in time to serve your queries.

QueryCompute
Type: QueryComputeResponse structure

Confirms the updated account settings for querying data in your account.

QueryPricingModel
Type: string

The pricing model for an account.

Errors

AccessDeniedException:

You do not have the necessary permissions to access the account settings.

InternalServerException:

An internal server error occurred while processing the request.

ThrottlingException:

The request was throttled due to excessive requests.

ValidationException:

Invalid or malformed request.

InvalidEndpointException:

The requested endpoint is invalid.

UpdateScheduledQuery

$result = $client->updateScheduledQuery([/* ... */]);
$promise = $client->updateScheduledQueryAsync([/* ... */]);

Update a scheduled query.

Parameter Syntax

$result = $client->updateScheduledQuery([
    'ScheduledQueryArn' => '<string>', // REQUIRED
    'State' => 'ENABLED|DISABLED', // REQUIRED
]);

Parameter Details

Members
ScheduledQueryArn
Required: Yes
Type: string

ARN of the scheuled query.

State
Required: Yes
Type: string

State of the scheduled query.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

AccessDeniedException:

You do not have the necessary permissions to access the account settings.

InternalServerException:

An internal server error occurred while processing the request.

ResourceNotFoundException:

The requested resource could not be found.

ThrottlingException:

The request was throttled due to excessive requests.

ValidationException:

Invalid or malformed request.

InvalidEndpointException:

The requested endpoint is invalid.

Shapes

AccessDeniedException

Description

You do not have the necessary permissions to access the account settings.

Members
Message
Type: string

AccountSettingsNotificationConfiguration

Description

Configuration settings for notifications related to account settings.

Members
RoleArn
Required: Yes
Type: string

An Amazon Resource Name (ARN) that grants Timestream permission to publish notifications. This field is only visible if SNS Topic is provided when updating the account settings.

SnsConfiguration
Type: SnsConfiguration structure

Details on SNS that are required to send the notification.

ColumnInfo

Description

Contains the metadata for query results such as the column names, data types, and other attributes.

Members
Name
Type: string

The name of the result set column. The name of the result set is available for columns of all data types except for arrays.

Type
Required: Yes
Type: Type structure

The data type of the result set column. The data type can be a scalar or complex. Scalar data types are integers, strings, doubles, Booleans, and others. Complex data types are types such as arrays, rows, and others.

ConflictException

Description

Unable to poll results for a cancelled query.

Members
Message
Type: string

Datum

Description

Datum represents a single data point in a query result.

Members
ArrayValue
Type: Array of Datum structures

Indicates if the data point is an array.

NullValue
Type: boolean

Indicates if the data point is null.

RowValue
Type: Row structure

Indicates if the data point is a row.

ScalarValue
Type: string

Indicates if the data point is a scalar value such as integer, string, double, or Boolean.

TimeSeriesValue
Type: Array of TimeSeriesDataPoint structures

Indicates if the data point is a timeseries data type.

DimensionMapping

Description

This type is used to map column(s) from the query result to a dimension in the destination table.

Members
DimensionValueType
Required: Yes
Type: string

Type for the dimension.

Name
Required: Yes
Type: string

Column name from query result.

Endpoint

Description

Represents an available endpoint against which to make API calls against, as well as the TTL for that endpoint.

Members
Address
Required: Yes
Type: string

An endpoint address.

CachePeriodInMinutes
Required: Yes
Type: long (int|float)

The TTL for the endpoint, in minutes.

ErrorReportConfiguration

Description

Configuration required for error reporting.

Members
S3Configuration
Required: Yes
Type: S3Configuration structure

The S3 configuration for the error reports.

ErrorReportLocation

Description

This contains the location of the error report for a single scheduled query call.

Members
S3ReportLocation
Type: S3ReportLocation structure

The S3 location where error reports are written.

ExecutionStats

Description

Statistics for a single scheduled query run.

Members
BytesMetered
Type: long (int|float)

Bytes metered for a single scheduled query run.

CumulativeBytesScanned
Type: long (int|float)

Bytes scanned for a single scheduled query run.

DataWrites
Type: long (int|float)

Data writes metered for records ingested in a single scheduled query run.

ExecutionTimeInMillis
Type: long (int|float)

Total time, measured in milliseconds, that was needed for the scheduled query run to complete.

QueryResultRows
Type: long (int|float)

Number of rows present in the output from running a query before ingestion to destination data source.

RecordsIngested
Type: long (int|float)

The number of records ingested for a single scheduled query run.

InternalServerException

Description

An internal server error occurred while processing the request.

Members
Message
Type: string

InvalidEndpointException

Description

The requested endpoint is invalid.

Members
Message
Type: string

LastUpdate

Description

Configuration object that contains the most recent account settings update, visible only if settings have been updated previously.

Members
Status
Type: string

The status of the last update. Can be either PENDING, FAILED, or SUCCEEDED.

StatusMessage
Type: string

Error message describing the last account settings update status, visible only if an error occurred.

TargetQueryTCU
Type: int

The number of TimeStream Compute Units (TCUs) requested in the last account settings update.

MixedMeasureMapping

Description

MixedMeasureMappings are mappings that can be used to ingest data into a mixture of narrow and multi measures in the derived table.

Members
MeasureName
Type: string

Refers to the value of measure_name in a result row. This field is required if MeasureNameColumn is provided.

MeasureValueType
Required: Yes
Type: string

Type of the value that is to be read from sourceColumn. If the mapping is for MULTI, use MeasureValueType.MULTI.

MultiMeasureAttributeMappings
Type: Array of MultiMeasureAttributeMapping structures

Required when measureValueType is MULTI. Attribute mappings for MULTI value measures.

SourceColumn
Type: string

This field refers to the source column from which measure-value is to be read for result materialization.

TargetMeasureName
Type: string

Target measure name to be used. If not provided, the target measure name by default would be measure-name if provided, or sourceColumn otherwise.

MultiMeasureAttributeMapping

Description

Attribute mapping for MULTI value measures.

Members
MeasureValueType
Required: Yes
Type: string

Type of the attribute to be read from the source column.

SourceColumn
Required: Yes
Type: string

Source column from where the attribute value is to be read.

TargetMultiMeasureAttributeName
Type: string

Custom name to be used for attribute name in derived table. If not provided, source column name would be used.

MultiMeasureMappings

Description

Only one of MixedMeasureMappings or MultiMeasureMappings is to be provided. MultiMeasureMappings can be used to ingest data as multi measures in the derived table.

Members
MultiMeasureAttributeMappings
Required: Yes
Type: Array of MultiMeasureAttributeMapping structures

Required. Attribute mappings to be used for mapping query results to ingest data for multi-measure attributes.

TargetMultiMeasureName
Type: string

The name of the target multi-measure name in the derived table. This input is required when measureNameColumn is not provided. If MeasureNameColumn is provided, then value from that column will be used as multi-measure name.

NotificationConfiguration

Description

Notification configuration for a scheduled query. A notification is sent by Timestream when a scheduled query is created, its state is updated or when it is deleted.

Members
SnsConfiguration
Required: Yes
Type: SnsConfiguration structure

Details about the Amazon Simple Notification Service (SNS) configuration. This field is visible only when SNS Topic is provided when updating the account settings.

ParameterMapping

Description

Mapping for named parameters.

Members
Name
Required: Yes
Type: string

Parameter name.

Type
Required: Yes
Type: Type structure

Contains the data type of a column in a query result set. The data type can be scalar or complex. The supported scalar data types are integers, Boolean, string, double, timestamp, date, time, and intervals. The supported complex data types are arrays, rows, and timeseries.

ProvisionedCapacityRequest

Description

A request to update the provisioned capacity settings for querying data.

Members
NotificationConfiguration

Configuration settings for notifications related to the provisioned capacity update.

TargetQueryTCU
Required: Yes
Type: int

The target compute capacity for querying data, specified in Timestream Compute Units (TCUs).

ProvisionedCapacityResponse

Description

The response to a request to update the provisioned capacity settings for querying data.

Members
ActiveQueryTCU
Type: int

The number of Timestream Compute Units (TCUs) provisioned in the account. This field is only visible when the compute mode is PROVISIONED.

LastUpdate
Type: LastUpdate structure

Information about the last update to the provisioned capacity settings.

NotificationConfiguration

An object that contains settings for notifications that are sent whenever the provisioned capacity settings are modified. This field is only visible when the compute mode is PROVISIONED.

QueryComputeRequest

Description

A request to retrieve or update the compute capacity settings for querying data.

Members
ComputeMode
Type: string

The mode in which Timestream Compute Units (TCUs) are allocated and utilized within an account. Note that in the Asia Pacific (Mumbai) region, the API operation only recognizes the value PROVISIONED.

ProvisionedCapacity
Type: ProvisionedCapacityRequest structure

Configuration object that contains settings for provisioned Timestream Compute Units (TCUs) in your account.

QueryComputeResponse

Description

The response to a request to retrieve or update the compute capacity settings for querying data.

Members
ComputeMode
Type: string

The mode in which Timestream Compute Units (TCUs) are allocated and utilized within an account. Note that in the Asia Pacific (Mumbai) region, the API operation only recognizes the value PROVISIONED.

ProvisionedCapacity
Type: ProvisionedCapacityResponse structure

Configuration object that contains settings for provisioned Timestream Compute Units (TCUs) in your account.

QueryExecutionException

Description

Timestream was unable to run the query successfully.

Members
Message
Type: string

QueryInsights

Description

QueryInsights is a performance tuning feature that helps you optimize your queries, reducing costs and improving performance. With QueryInsights, you can assess the pruning efficiency of your queries and identify areas for improvement to enhance query performance. With QueryInsights, you can also analyze the effectiveness of your queries in terms of temporal and spatial pruning, and identify opportunities to improve performance. Specifically, you can evaluate how well your queries use time-based and partition key-based indexing strategies to optimize data retrieval. To optimize query performance, it's essential that you fine-tune both the temporal and spatial parameters that govern query execution.

The key metrics provided by QueryInsights are QuerySpatialCoverage and QueryTemporalRange. QuerySpatialCoverage indicates how much of the spatial axis the query scans, with lower values being more efficient. QueryTemporalRange shows the time range scanned, with narrower ranges being more performant.

Benefits of QueryInsights

The following are the key benefits of using QueryInsights:

  • Identifying inefficient queriesQueryInsights provides information on the time-based and attribute-based pruning of the tables accessed by the query. This information helps you identify the tables that are sub-optimally accessed.

  • Optimizing your data model and partitioning – You can use the QueryInsights information to access and fine-tune your data model and partitioning strategy.

  • Tuning queriesQueryInsights highlights opportunities to use indexes more effectively.

The maximum number of Query API requests you're allowed to make with QueryInsights enabled is 1 query per second (QPS). If you exceed this query rate, it might result in throttling.

Members
Mode
Required: Yes
Type: string

Provides the following modes to enable QueryInsights:

  • ENABLED_WITH_RATE_CONTROL – Enables QueryInsights for the queries being processed. This mode also includes a rate control mechanism, which limits the QueryInsights feature to 1 query per second (QPS).

  • DISABLED – Disables QueryInsights.

QueryInsightsResponse

Description

Provides various insights and metrics related to the query that you executed.

Members
OutputBytes
Type: long (int|float)

Indicates the size of query result set in bytes. You can use this data to validate if the result set has changed as part of the query tuning exercise.

OutputRows
Type: long (int|float)

Indicates the total number of rows returned as part of the query result set. You can use this data to validate if the number of rows in the result set have changed as part of the query tuning exercise.

QuerySpatialCoverage
Type: QuerySpatialCoverage structure

Provides insights into the spatial coverage of the query, including the table with sub-optimal (max) spatial pruning. This information can help you identify areas for improvement in your partitioning strategy to enhance spatial pruning.

QueryTableCount
Type: long (int|float)

Indicates the number of tables in the query.

QueryTemporalRange
Type: QueryTemporalRange structure

Provides insights into the temporal range of the query, including the table with the largest (max) time range. Following are some of the potential options for optimizing time-based pruning:

  • Add missing time-predicates.

  • Remove functions around the time predicates.

  • Add time predicates to all the sub-queries.

UnloadPartitionCount
Type: long (int|float)

Indicates the partitions created by the Unload operation.

UnloadWrittenBytes
Type: long (int|float)

Indicates the size, in bytes, written by the Unload operation.

UnloadWrittenRows
Type: long (int|float)

Indicates the rows written by the Unload query.

QuerySpatialCoverage

Description

Provides insights into the spatial coverage of the query, including the table with sub-optimal (max) spatial pruning. This information can help you identify areas for improvement in your partitioning strategy to enhance spatial pruning

For example, you can do the following with the QuerySpatialCoverage information:

  • Add measure_name or use customer-defined partition key (CDPK) predicates.

  • If you've already done the preceding action, remove functions around them or clauses, such as LIKE.

Members
Max
Type: QuerySpatialCoverageMax structure

Provides insights into the spatial coverage of the executed query and the table with the most inefficient spatial pruning.

  • Value – The maximum ratio of spatial coverage.

  • TableArn – The Amazon Resource Name (ARN) of the table with sub-optimal spatial pruning.

  • PartitionKey – The partition key used for partitioning, which can be a default measure_name or a CDPK.

QuerySpatialCoverageMax

Description

Provides insights into the table with the most sub-optimal spatial range scanned by your query.

Members
PartitionKey
Type: Array of strings

The partition key used for partitioning, which can be a default measure_name or a customer defined partition key.

TableArn
Type: string

The Amazon Resource Name (ARN) of the table with the most sub-optimal spatial pruning.

Value
Type: double

The maximum ratio of spatial coverage.

QueryStatus

Description

Information about the status of the query, including progress and bytes scanned.

Members
CumulativeBytesMetered
Type: long (int|float)

The amount of data scanned by the query in bytes that you will be charged for. This is a cumulative sum and represents the total amount of data that you will be charged for since the query was started. The charge is applied only once and is either applied when the query completes running or when the query is cancelled.

CumulativeBytesScanned
Type: long (int|float)

The amount of data scanned by the query in bytes. This is a cumulative sum and represents the total amount of bytes scanned since the query was started.

ProgressPercentage
Type: double

The progress of the query, expressed as a percentage.

QueryTemporalRange

Description

Provides insights into the temporal range of the query, including the table with the largest (max) time range.

Members
Max
Type: QueryTemporalRangeMax structure

Encapsulates the following properties that provide insights into the most sub-optimal performing table on the temporal axis:

  • Value – The maximum duration in nanoseconds between the start and end of the query.

  • TableArn – The Amazon Resource Name (ARN) of the table which is queried with the largest time range.

QueryTemporalRangeMax

Description

Provides insights into the table with the most sub-optimal temporal pruning scanned by your query.

Members
TableArn
Type: string

The Amazon Resource Name (ARN) of the table which is queried with the largest time range.

Value
Type: long (int|float)

The maximum duration in nanoseconds between the start and end of the query.

ResourceNotFoundException

Description

The requested resource could not be found.

Members
Message
Type: string
ScheduledQueryArn
Type: string

The ARN of the scheduled query.

Row

Description

Represents a single row in the query results.

Members
Data
Required: Yes
Type: Array of Datum structures

List of data points in a single row of the result set.

S3Configuration

Description

Details on S3 location for error reports that result from running a query.

Members
BucketName
Required: Yes
Type: string

Name of the S3 bucket under which error reports will be created.

EncryptionOption
Type: string

Encryption at rest options for the error reports. If no encryption option is specified, Timestream will choose SSE_S3 as default.

ObjectKeyPrefix
Type: string

Prefix for the error report key. Timestream by default adds the following prefix to the error report path.

S3ReportLocation

Description

S3 report location for the scheduled query run.

Members
BucketName
Type: string

S3 bucket name.

ObjectKey
Type: string

S3 key.

ScheduleConfiguration

Description

Configuration of the schedule of the query.

Members
ScheduleExpression
Required: Yes
Type: string

An expression that denotes when to trigger the scheduled query run. This can be a cron expression or a rate expression.

ScheduledQuery

Description

Scheduled Query

Members
Arn
Required: Yes
Type: string

The Amazon Resource Name.

CreationTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

The creation time of the scheduled query.

ErrorReportConfiguration
Type: ErrorReportConfiguration structure

Configuration for scheduled query error reporting.

LastRunStatus
Type: string

Status of the last scheduled query run.

Name
Required: Yes
Type: string

The name of the scheduled query.

NextInvocationTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

The next time the scheduled query is to be run.

PreviousInvocationTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

The last time the scheduled query was run.

State
Required: Yes
Type: string

State of scheduled query.

TargetDestination
Type: TargetDestination structure

Target data source where final scheduled query result will be written.

ScheduledQueryDescription

Description

Structure that describes scheduled query.

Members
Arn
Required: Yes
Type: string

Scheduled query ARN.

CreationTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Creation time of the scheduled query.

ErrorReportConfiguration
Type: ErrorReportConfiguration structure

Error-reporting configuration for the scheduled query.

KmsKeyId
Type: string

A customer provided KMS key used to encrypt the scheduled query resource.

LastRunSummary
Type: ScheduledQueryRunSummary structure

Runtime summary for the last scheduled query run.

Name
Required: Yes
Type: string

Name of the scheduled query.

NextInvocationTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

The next time the scheduled query is scheduled to run.

NotificationConfiguration
Required: Yes
Type: NotificationConfiguration structure

Notification configuration.

PreviousInvocationTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

Last time the query was run.

QueryString
Required: Yes
Type: string

The query to be run.

RecentlyFailedRuns
Type: Array of ScheduledQueryRunSummary structures

Runtime summary for the last five failed scheduled query runs.

ScheduleConfiguration
Required: Yes
Type: ScheduleConfiguration structure

Schedule configuration.

ScheduledQueryExecutionRoleArn
Type: string

IAM role that Timestream uses to run the schedule query.

State
Required: Yes
Type: string

State of the scheduled query.

TargetConfiguration
Type: TargetConfiguration structure

Scheduled query target store configuration.

ScheduledQueryInsights

Description

Encapsulates settings for enabling QueryInsights on an ExecuteScheduledQueryRequest.

Members
Mode
Required: Yes
Type: string

Provides the following modes to enable ScheduledQueryInsights:

  • ENABLED_WITH_RATE_CONTROL – Enables ScheduledQueryInsights for the queries being processed. This mode also includes a rate control mechanism, which limits the QueryInsights feature to 1 query per second (QPS).

  • DISABLED – Disables ScheduledQueryInsights.

ScheduledQueryInsightsResponse

Description

Provides various insights and metrics related to the ExecuteScheduledQueryRequest that was executed.

Members
OutputBytes
Type: long (int|float)

Indicates the size of query result set in bytes. You can use this data to validate if the result set has changed as part of the query tuning exercise.

OutputRows
Type: long (int|float)

Indicates the total number of rows returned as part of the query result set. You can use this data to validate if the number of rows in the result set have changed as part of the query tuning exercise.

QuerySpatialCoverage
Type: QuerySpatialCoverage structure

Provides insights into the spatial coverage of the query, including the table with sub-optimal (max) spatial pruning. This information can help you identify areas for improvement in your partitioning strategy to enhance spatial pruning.

QueryTableCount
Type: long (int|float)

Indicates the number of tables in the query.

QueryTemporalRange
Type: QueryTemporalRange structure

Provides insights into the temporal range of the query, including the table with the largest (max) time range. Following are some of the potential options for optimizing time-based pruning:

  • Add missing time-predicates.

  • Remove functions around the time predicates.

  • Add time predicates to all the sub-queries.

ScheduledQueryRunSummary

Description

Run summary for the scheduled query

Members
ErrorReportLocation
Type: ErrorReportLocation structure

S3 location for error report.

ExecutionStats
Type: ExecutionStats structure

Runtime statistics for a scheduled run.

FailureReason
Type: string

Error message for the scheduled query in case of failure. You might have to look at the error report to get more detailed error reasons.

InvocationTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

InvocationTime for this run. This is the time at which the query is scheduled to run. Parameter @scheduled_runtime can be used in the query to get the value.

QueryInsightsResponse

Provides various insights and metrics related to the run summary of the scheduled query.

RunStatus
Type: string

The status of a scheduled query run.

TriggerTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

The actual time when the query was run.

SelectColumn

Description

Details of the column that is returned by the query.

Members
Aliased
Type: boolean

True, if the column name was aliased by the query. False otherwise.

DatabaseName
Type: string

Database that has this column.

Name
Type: string

Name of the column.

TableName
Type: string

Table within the database that has this column.

Type
Type: Type structure

Contains the data type of a column in a query result set. The data type can be scalar or complex. The supported scalar data types are integers, Boolean, string, double, timestamp, date, time, and intervals. The supported complex data types are arrays, rows, and timeseries.

ServiceQuotaExceededException

Description

You have exceeded the service quota.

Members
Message
Type: string

SnsConfiguration

Description

Details on SNS that are required to send the notification.

Members
TopicArn
Required: Yes
Type: string

SNS topic ARN that the scheduled query status notifications will be sent to.

Tag

Description

A tag is a label that you assign to a Timestream database and/or table. Each tag consists of a key and an optional value, both of which you define. Tags enable you to categorize databases and/or tables, for example, by purpose, owner, or environment.

Members
Key
Required: Yes
Type: string

The key of the tag. Tag keys are case sensitive.

Value
Required: Yes
Type: string

The value of the tag. Tag values are case sensitive and can be null.

TargetConfiguration

Description

Configuration used for writing the output of a query.

Members
TimestreamConfiguration
Required: Yes
Type: TimestreamConfiguration structure

Configuration needed to write data into the Timestream database and table.

TargetDestination

Description

Destination details to write data for a target data source. Current supported data source is Timestream.

Members
TimestreamDestination
Type: TimestreamDestination structure

Query result destination details for Timestream data source.

ThrottlingException

Description

The request was throttled due to excessive requests.

Members
Message
Type: string

TimeSeriesDataPoint

Description

The timeseries data type represents the values of a measure over time. A time series is an array of rows of timestamps and measure values, with rows sorted in ascending order of time. A TimeSeriesDataPoint is a single data point in the time series. It represents a tuple of (time, measure value) in a time series.

Members
Time
Required: Yes
Type: string

The timestamp when the measure value was collected.

Value
Required: Yes
Type: Datum structure

The measure value for the data point.

TimestreamConfiguration

Description

Configuration to write data into Timestream database and table. This configuration allows the user to map the query result select columns into the destination table columns.

Members
DatabaseName
Required: Yes
Type: string

Name of Timestream database to which the query result will be written.

DimensionMappings
Required: Yes
Type: Array of DimensionMapping structures

This is to allow mapping column(s) from the query result to the dimension in the destination table.

MeasureNameColumn
Type: string

Name of the measure column.

MixedMeasureMappings
Type: Array of MixedMeasureMapping structures

Specifies how to map measures to multi-measure records.

MultiMeasureMappings
Type: MultiMeasureMappings structure

Multi-measure mappings.

TableName
Required: Yes
Type: string

Name of Timestream table that the query result will be written to. The table should be within the same database that is provided in Timestream configuration.

TimeColumn
Required: Yes
Type: string

Column from query result that should be used as the time column in destination table. Column type for this should be TIMESTAMP.

TimestreamDestination

Description

Destination for scheduled query.

Members
DatabaseName
Type: string

Timestream database name.

TableName
Type: string

Timestream table name.

Type

Description

Contains the data type of a column in a query result set. The data type can be scalar or complex. The supported scalar data types are integers, Boolean, string, double, timestamp, date, time, and intervals. The supported complex data types are arrays, rows, and timeseries.

Members
ArrayColumnInfo
Type: ColumnInfo structure

Indicates if the column is an array.

RowColumnInfo
Type: Array of ColumnInfo structures

Indicates if the column is a row.

ScalarType
Type: string

Indicates if the column is of type string, integer, Boolean, double, timestamp, date, time. For more information, see Supported data types.

TimeSeriesMeasureValueColumnInfo
Type: ColumnInfo structure

Indicates if the column is a timeseries data type.

ValidationException

Description

Invalid or malformed request.

Members
Message
Type: string