Skip to content

Timestream query

async_boto.clients.timestream_query

logger module-attribute

logger = getLogger(__name__)

T module-attribute

T = TypeVar('T', bound=BaseModel)

AsyncTimestreamQueryClient

AsyncTimestreamQueryClient(aws_session)

Bases: BaseClient

Source code in async_boto/clients/timestream_query.py
73
74
75
76
77
def __init__(self, aws_session: boto3.Session | AsyncAWSSession):
    super().__init__(aws_session=aws_session, service_name="timestream")
    self._url = (
        f"https://query.timestream.{self._aws_session.region_name}.amazonaws.com"
    )

describe_endpoints async

describe_endpoints()
Source code in async_boto/clients/timestream_query.py
 95
 96
 97
 98
 99
100
101
102
103
104
async def describe_endpoints(self):
    headers = {
        "Content-Type": "application/x-amz-json-1.0",
        "X-Amz-Target": "Timestream_20181101.DescribeEndpoints",
        "x-amz-api-version": "2018-11-01",
    }
    resp = await self._post(url=self._url, headers=headers, json={})
    print(resp.json)
    resp.raise_for_status()
    return DescribeEndpointsResponse(**resp.json)

cancel_query async

cancel_query(request)
Source code in async_boto/clients/timestream_query.py
106
107
108
109
110
111
112
113
114
async def cancel_query(self, request: CancelQueryRequest) -> CancelQueryResponse:
    endpoint = await self.describe_endpoints()
    endpoint_to_use = random.choice(endpoint.Endpoints)
    return await self._make_request(
        "Timestream_20181101.CancelQuery",
        request,
        CancelQueryResponse,
        url=f"https://{endpoint_to_use.Address}",
    )

create_scheduled_query async

create_scheduled_query(request)
Source code in async_boto/clients/timestream_query.py
116
117
118
119
120
121
122
123
124
125
126
async def create_scheduled_query(
    self, request: CreateScheduledQueryRequest
) -> CreateScheduledQueryResponse:
    endpoint = await self.describe_endpoints()
    endpoint_to_use = random.choice(endpoint.Endpoints)
    return await self._make_request(
        "Timestream_20181101.CreateScheduledQuery",
        request,
        CreateScheduledQueryResponse,
        url=f"https://{endpoint_to_use.Address}",
    )

delete_scheduled_query async

delete_scheduled_query(request)
Source code in async_boto/clients/timestream_query.py
128
129
130
131
132
133
134
135
136
137
138
async def delete_scheduled_query(
    self, request: DeleteScheduledQueryRequest
) -> DeleteScheduledQueryResponse:
    endpoint = await self.describe_endpoints()
    endpoint_to_use = random.choice(endpoint.Endpoints)
    return await self._make_request(
        "Timestream_20181101.DeleteScheduledQuery",
        request,
        DeleteScheduledQueryResponse,
        url=f"https://{endpoint_to_use.Address}",
    )

describe_account_settings async

describe_account_settings(request)

Describe the settings for your Timestream account.

This method retrieves account-specific settings, including the query pricing model and the maximum Timestream Compute Units (TCUs) configured for query workloads.

Notes
  • You are charged only for the duration of compute units used for your workloads.
PARAMETER DESCRIPTION
request

The request object for describing account settings.

TYPE: DescribeAccountSettingsRequest

RETURNS DESCRIPTION
DescribeAccountSettingsResponse

A response containing the account settings, including: - QueryPricingModel: The pricing model for queries - MaxQueryTCUs: Maximum TCUs configured for query workloads

RAISES DESCRIPTION
Exception

If there is an error retrieving the account settings.

Source code in async_boto/clients/timestream_query.py
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
async def describe_account_settings(
    self, request: DescribeAccountSettingsRequest
) -> DescribeAccountSettingsResponse:
    """
    Describe the settings for your Timestream account.

    This method retrieves account-specific settings, including the query pricing
    model and the maximum Timestream Compute Units (TCUs) configured for query
    workloads.

    Notes
    -----
    - You are charged only for the duration of compute units used for your
    workloads.

    Parameters
    ----------
    request : DescribeAccountSettingsRequest
        The request object for describing account settings.

    Returns
    -------
    DescribeAccountSettingsResponse
        A response containing the account settings, including:
        - QueryPricingModel: The pricing model for queries
        - MaxQueryTCUs: Maximum TCUs configured for query workloads

    Raises
    ------
    Exception
        If there is an error retrieving the account settings.
    """
    endpoint = await self.describe_endpoints()
    endpoint_to_use = random.choice(endpoint.Endpoints)
    return await self._make_request(
        "Timestream_20181101.DescribeAccountSettings",
        request,
        DescribeAccountSettingsResponse,
        url=f"https://{endpoint_to_use.Address}",
    )

describe_scheduled_query async

describe_scheduled_query(request)

Provides detailed information about a scheduled query.

PARAMETER DESCRIPTION
request

The request object containing details for the scheduled query to describe.

TYPE: DescribeScheduledQueryRequest

RETURNS DESCRIPTION
DescribeScheduledQueryResponse

A response object with detailed information about the specified scheduled query.

RAISES DESCRIPTION
Exception

If there is an error retrieving the scheduled query information.

Source code in async_boto/clients/timestream_query.py
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
async def describe_scheduled_query(
    self, request: DescribeScheduledQueryRequest
) -> DescribeScheduledQueryResponse:
    """
    Provides detailed information about a scheduled query.

    Parameters
    ----------
    request : DescribeScheduledQueryRequest
        The request object containing details for the scheduled query to describe.

    Returns
    -------
    DescribeScheduledQueryResponse
        A response object with detailed information about the specified scheduled
        query.

    Raises
    ------
    Exception
        If there is an error retrieving the scheduled query information.
    """
    endpoint = await self.describe_endpoints()
    endpoint_to_use = random.choice(endpoint.Endpoints)
    return await self._make_request(
        "Timestream_20181101.DescribeScheduledQuery",
        request,
        DescribeScheduledQueryResponse,
        url=f"https://{endpoint_to_use.Address}",
    )

execute_scheduled_query async

execute_scheduled_query(request)

Manually run a scheduled query.

This method allows manual execution of a scheduled query. When QueryInsights is enabled, the method also returns insights and metrics related to the executed query as part of an Amazon SNS notification.

Notes
  • QueryInsights can help with performance tuning of your query.
  • For detailed information about QueryInsights, refer to the Amazon Timestream documentation on optimizing queries.
PARAMETER DESCRIPTION
request

The request object containing details for executing the scheduled query.

TYPE: ExecuteScheduledQueryRequest

RETURNS DESCRIPTION
ExecuteScheduledQueryResponse

A response object with the results of the executed scheduled query, and potentially including query insights if enabled.

RAISES DESCRIPTION
Exception

If there is an error executing the scheduled query.

Source code in async_boto/clients/timestream_query.py
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
async def execute_scheduled_query(
    self, request: ExecuteScheduledQueryRequest
) -> ExecuteScheduledQueryResponse:
    """
    Manually run a scheduled query.

    This method allows manual execution of a scheduled query. When QueryInsights
    is enabled, the method also returns insights and metrics related to the
    executed query as part of an Amazon SNS notification.

    Notes
    -----
    - QueryInsights can help with performance tuning of your query.
    - For detailed information about QueryInsights, refer to the Amazon
      Timestream documentation on optimizing queries.

    Parameters
    ----------
    request : ExecuteScheduledQueryRequest
        The request object containing details for executing the scheduled query.

    Returns
    -------
    ExecuteScheduledQueryResponse
        A response object with the results of the executed scheduled query,
        and potentially including query insights if enabled.

    Raises
    ------
    Exception
        If there is an error executing the scheduled query.
    """
    endpoint = await self.describe_endpoints()
    endpoint_to_use = random.choice(endpoint.Endpoints)
    return await self._make_request(
        "Timestream_20181101.ExecuteScheduledQuery",
        request,
        ExecuteScheduledQueryResponse,
        url=f"https://{endpoint_to_use.Address}",
    )

list_scheduled_queries async

list_scheduled_queries(request)

Retrieve a list of all scheduled queries in the current Amazon account and Region.

Notes
  • This method is eventually consistent, meaning the returned list may not immediately reflect all recent changes to scheduled queries.
PARAMETER DESCRIPTION
request

The request object for listing scheduled queries.

TYPE: ListScheduledQueriesRequest

RETURNS DESCRIPTION
ListScheduledQueriesResponse

A response object containing the list of scheduled queries.

RAISES DESCRIPTION
Exception

If there is an error retrieving the list of scheduled queries.

Source code in async_boto/clients/timestream_query.py
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
async def list_scheduled_queries(
    self, request: ListScheduledQueriesRequest
) -> ListScheduledQueriesResponse:
    """
    Retrieve a list of all scheduled queries in the current Amazon account and
    Region.

    Notes
    -----
    - This method is eventually consistent, meaning the returned list may not
      immediately reflect all recent changes to scheduled queries.

    Parameters
    ----------
    request : ListScheduledQueriesRequest
        The request object for listing scheduled queries.

    Returns
    -------
    ListScheduledQueriesResponse
        A response object containing the list of scheduled queries.

    Raises
    ------
    Exception
        If there is an error retrieving the list of scheduled queries.
    """
    endpoint = await self.describe_endpoints()
    endpoint_to_use = random.choice(endpoint.Endpoints)
    return await self._make_request(
        "Timestream_20181101.ListScheduledQueries",
        request,
        ListScheduledQueriesResponse,
        url=f"https://{endpoint_to_use.Address}",
    )

list_tags_for_resource async

list_tags_for_resource(request)

List all tags associated with a Timestream query resource.

PARAMETER DESCRIPTION
request

The request object containing the resource for which to list tags.

TYPE: ListTagsForResourceRequest

RETURNS DESCRIPTION
ListTagsForResourceResponse

A response object containing the list of tags for the specified resource.

RAISES DESCRIPTION
Exception

If there is an error retrieving the tags for the resource.

Source code in async_boto/clients/timestream_query.py
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
async def list_tags_for_resource(
    self, request: ListTagsForResourceRequest
) -> ListTagsForResourceResponse:
    """
    List all tags associated with a Timestream query resource.

    Parameters
    ----------
    request : ListTagsForResourceRequest
        The request object containing the resource for which to list tags.

    Returns
    -------
    ListTagsForResourceResponse
        A response object containing the list of tags for the specified resource.

    Raises
    ------
    Exception
        If there is an error retrieving the tags for the resource.
    """
    endpoint = await self.describe_endpoints()
    endpoint_to_use = random.choice(endpoint.Endpoints)
    return await self._make_request(
        "Timestream_20181101.ListTagsForResource",
        request,
        ListTagsForResourceResponse,
        url=f"https://{endpoint_to_use.Address}",
    )

prepare_query async

prepare_query(request)

Submit a query with parameters to be stored by Timestream for later running.

Notes
  • This is a synchronous operation.
  • Timestream currently only supports using this operation with ValidateOnly set to true.
PARAMETER DESCRIPTION
request

The request object containing the query to be prepared. The ValidateOnly parameter should be set to true.

TYPE: PrepareQueryRequest

RETURNS DESCRIPTION
PrepareQueryResponse

A response object containing the result of the query preparation.

RAISES DESCRIPTION
Exception

If there is an error preparing the query.

Warnings

Ensure that the ValidateOnly parameter is set to true as Timestream currently only supports validation mode.

Source code in async_boto/clients/timestream_query.py
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
async def prepare_query(self, request: PrepareQueryRequest) -> PrepareQueryResponse:
    """
    Submit a query with parameters to be stored by Timestream for later running.

    Notes
    -----
    - This is a synchronous operation.
    - Timestream currently only supports using this operation with
      `ValidateOnly` set to `true`.

    Parameters
    ----------
    request : PrepareQueryRequest
        The request object containing the query to be prepared.
        The `ValidateOnly` parameter should be set to `true`.

    Returns
    -------
    PrepareQueryResponse
        A response object containing the result of the query preparation.

    Raises
    ------
    Exception
        If there is an error preparing the query.

    Warnings
    --------
    Ensure that the `ValidateOnly` parameter is set to `true` as
    Timestream currently only supports validation mode.
    """
    endpoint = await self.describe_endpoints()
    endpoint_to_use = random.choice(endpoint.Endpoints)
    return await self._make_request(
        "Timestream_20181101.PrepareQuery",
        request,
        PrepareQueryResponse,
        url=f"https://{endpoint_to_use.Address}",
    )

query async

query(request)

Run a synchronous query against Amazon Timestream data.

Notes
  • Supports QueryInsights for performance tuning when enabled.
  • Strict usage constraints and limitations apply:
    • Maximum 1 query per second (QPS) with QueryInsights enabled
    • Query timeout is 60 seconds
    • Idempotency window of 5 minutes for client tokens
    • Maximum row size (including metadata) is 1 MB
Warnings

Query will fail under the following conditions: - Submitting a query with the same client token outside the 5-minute idempotency window - Changing parameters while using the same client token within the idempotency window - Row size (including query metadata) exceeding 1 MB - IAM principal mismatch between query initiator and result reader - Different query strings for query initiator and result reader

PARAMETER DESCRIPTION
request

The request object containing the query to be executed.

TYPE: QueryRequest

RETURNS DESCRIPTION
QueryResponse

A response object containing the query results and potentially QueryInsights if enabled.

RAISES DESCRIPTION
Exception

If there is an error executing the query or if any of the specified conditions are violated.

Source code in async_boto/clients/timestream_query.py
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
async def query(self, request: QueryRequest) -> QueryResponse:
    """
    Run a synchronous query against Amazon Timestream data.

    Notes
    -----
    - Supports QueryInsights for performance tuning when enabled.
    - Strict usage constraints and limitations apply:
        * Maximum 1 query per second (QPS) with QueryInsights enabled
        * Query timeout is 60 seconds
        * Idempotency window of 5 minutes for client tokens
        * Maximum row size (including metadata) is 1 MB

    Warnings
    --------
    Query will fail under the following conditions:
    - Submitting a query with the same client token outside the 5-minute idempotency
      window
    - Changing parameters while using the same client token within the idempotency
      window
    - Row size (including query metadata) exceeding 1 MB
    - IAM principal mismatch between query initiator and result reader
    - Different query strings for query initiator and result reader

    Parameters
    ----------
    request : QueryRequest
        The request object containing the query to be executed.

    Returns
    -------
    QueryResponse
        A response object containing the query results and potentially
        QueryInsights if enabled.

    Raises
    ------
    Exception
        If there is an error executing the query or if any of the
        specified conditions are violated.
    """
    endpoint = await self.describe_endpoints()
    endpoint_to_use = random.choice(endpoint.Endpoints)
    return await self._make_request(
        "Timestream_20181101.Query",
        request,
        QueryResponse,
        url=f"https://{endpoint_to_use.Address}",
    )

tag_resource async

tag_resource(request)

Associate a set of tags with a Timestream resource.

Notes
  • Tagged resources can be activated for cost allocation tracking.
  • Tags will appear on the Billing and Cost Management console.
PARAMETER DESCRIPTION
request

The request object containing the resource and tags to be associated.

TYPE: TagResourceRequest

RETURNS DESCRIPTION
TagResourceResponse

A response object indicating the result of the tagging operation.

RAISES DESCRIPTION
Exception

If there is an error associating tags with the resource.

Source code in async_boto/clients/timestream_query.py
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
async def tag_resource(self, request: TagResourceRequest) -> TagResourceResponse:
    """
    Associate a set of tags with a Timestream resource.

    Notes
    -----
    - Tagged resources can be activated for cost allocation tracking.
    - Tags will appear on the Billing and Cost Management console.

    Parameters
    ----------
    request : TagResourceRequest
        The request object containing the resource and tags to be associated.

    Returns
    -------
    TagResourceResponse
        A response object indicating the result of the tagging operation.

    Raises
    ------
    Exception
        If there is an error associating tags with the resource.
    """
    endpoint = await self.describe_endpoints()
    endpoint_to_use = random.choice(endpoint.Endpoints)
    return await self._make_request(
        "Timestream_20181101.TagResource",
        request,
        TagResourceResponse,
        url=f"https://{endpoint_to_use.Address}",
    )

untag_resource async

untag_resource(request)

Remove the association of tags from a Timestream query resource.

PARAMETER DESCRIPTION
request

The request object containing the resource and tags to be removed.

TYPE: UntagResourceRequest

RETURNS DESCRIPTION
UntagResourceResponse

A response object indicating the result of the untagging operation.

RAISES DESCRIPTION
Exception

If there is an error removing tags from the resource.

Source code in async_boto/clients/timestream_query.py
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
async def untag_resource(
    self, request: UntagResourceRequest
) -> UntagResourceResponse:
    """
    Remove the association of tags from a Timestream query resource.

    Parameters
    ----------
    request : UntagResourceRequest
        The request object containing the resource and tags to be removed.

    Returns
    -------
    UntagResourceResponse
        A response object indicating the result of the untagging operation.

    Raises
    ------
    Exception
        If there is an error removing tags from the resource.
    """
    endpoint = await self.describe_endpoints()
    endpoint_to_use = random.choice(endpoint.Endpoints)
    return await self._make_request(
        "Timestream_20181101.UntagResource",
        request,
        UntagResourceResponse,
        url=f"https://{endpoint_to_use.Address}",
    )

update_account_settings async

update_account_settings(request)

Update account settings for Timestream query pricing and compute units.

Notes
  • Transitions the account to use Timestream Compute Units (TCUs) for query pricing.
  • Modifies the maximum query compute units configuration.
  • Reducing MaxQueryTCU may take up to 24 hours to become effective.
  • Once transitioned to TCUs, you cannot revert to bytes scanned pricing.
PARAMETER DESCRIPTION
request

The request object containing the updated account settings.

TYPE: UpdateAccountSettingsRequest

RETURNS DESCRIPTION
UpdateAccountSettingsResponse

A response object indicating the result of the account settings update.

RAISES DESCRIPTION
Exception

If there is an error updating the account settings.

Warnings

Changes to MaxQueryTCU may have a delayed implementation of up to 24 hours.

Source code in async_boto/clients/timestream_query.py
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
async def update_account_settings(
    self, request: UpdateAccountSettingsRequest
) -> UpdateAccountSettingsResponse:
    """
    Update account settings for Timestream query pricing and compute units.

    Notes
    -----
    - Transitions the account to use Timestream Compute Units (TCUs) for
      query pricing.
    - Modifies the maximum query compute units configuration.
    - Reducing MaxQueryTCU may take up to 24 hours to become effective.
    - Once transitioned to TCUs, you cannot revert to bytes scanned pricing.

    Parameters
    ----------
    request : UpdateAccountSettingsRequest
        The request object containing the updated account settings.

    Returns
    -------
    UpdateAccountSettingsResponse
        A response object indicating the result of the account settings update.

    Raises
    ------
    Exception
        If there is an error updating the account settings.

    Warnings
    --------
    Changes to MaxQueryTCU may have a delayed implementation of up to 24 hours.
    """
    endpoint = await self.describe_endpoints()
    endpoint_to_use = random.choice(endpoint.Endpoints)
    return await self._make_request(
        "Timestream_20181101.UpdateAccountSettings",
        request,
        UpdateAccountSettingsResponse,
        url=f"https://{endpoint_to_use.Address}",
    )

update_scheduled_query async

update_scheduled_query(request)

Update a scheduled query.

PARAMETER DESCRIPTION
request

The request object containing the details for updating the scheduled query.

TYPE: UpdateScheduledQueryRequest

RETURNS DESCRIPTION
UpdateScheduledQueryResponse

A response object indicating the result of the scheduled query update.

RAISES DESCRIPTION
Exception

If there is an error updating the scheduled query.

Source code in async_boto/clients/timestream_query.py
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
async def update_scheduled_query(
    self, request: UpdateScheduledQueryRequest
) -> UpdateScheduledQueryResponse:
    """
    Update a scheduled query.

    Parameters
    ----------
    request : UpdateScheduledQueryRequest
        The request object containing the details for updating the scheduled query.

    Returns
    -------
    UpdateScheduledQueryResponse
        A response object indicating the result of the scheduled query update.

    Raises
    ------
    Exception
        If there is an error updating the scheduled query.
    """
    endpoint = await self.describe_endpoints()
    endpoint_to_use = random.choice(endpoint.Endpoints)
    return await self._make_request(
        "Timestream_20181101.UpdateScheduledQuery",
        request,
        UpdateScheduledQueryResponse,
        url=f"https://{endpoint_to_use.Address}",
    )

paginate async

paginate(method_name, request)
Source code in async_boto/core/base_client.py
255
256
257
258
259
260
261
262
263
async def paginate(self, method_name, request: BaseModel):
    if method_name not in self._paginators:
        raise ValueError(
            f"Method {method_name} is not paginatable. "
            f"Available methods: {list(self._paginators.keys())}"
        )
    paginator = paginate(self, request=request, **self._paginators[method_name])
    async for page in paginator:
        yield page