Skip to content

Examples

Index > TimestreamQuery > Examples

Auto-generated documentation for TimestreamQuery type annotations stubs module types-aiobotocore-timestream-query.

Client

Implicit type annotations

Can be used with types-aioboto3[timestream-query] package installed.

Write your TimestreamQuery code as usual, type checking and code completion should work out of the box.

Client usage example
from aioboto3.session import Session


session = Session()

async with session.client("timestream-query") as client:  # (1)
    result = await client.cancel_query()  # (2)
  1. client: TimestreamQueryClient
  2. result: CancelQueryResponseTypeDef
Paginator usage example
from aioboto3.session import Session


session = Session()

async with session.client("timestream-query") as client:  # (1)
    paginator = client.get_paginator("list_scheduled_queries")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: TimestreamQueryClient
  2. paginator: ListScheduledQueriesPaginator
  3. item: ListScheduledQueriesResponseTypeDef

Explicit type annotations

With types-aioboto3-lite[timestream-query] or a standalone types_aiobotocore_timestream_query package, you have to explicitly specify client: TimestreamQueryClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

Client usage example
from aioboto3.session import Session

from types_aiobotocore_timestream_query.client import TimestreamQueryClient
from types_aiobotocore_timestream_query.type_defs import CancelQueryResponseTypeDef
from types_aiobotocore_timestream_query.type_defs import CancelQueryRequestRequestTypeDef


session = Session()

client: TimestreamQueryClient
async with session.client("timestream-query") as client:  # (1)
    kwargs: CancelQueryRequestRequestTypeDef = {...}  # (2)
    result: CancelQueryResponseTypeDef = await client.cancel_query(**kwargs)  # (3)
  1. client: TimestreamQueryClient
  2. kwargs: CancelQueryRequestRequestTypeDef
  3. result: CancelQueryResponseTypeDef
Paginator usage example
from aioboto3.session import Session

from types_aiobotocore_timestream_query.client import TimestreamQueryClient
from types_aiobotocore_timestream_query.paginator import ListScheduledQueriesPaginator
from types_aiobotocore_timestream_query.type_defs import ListScheduledQueriesResponseTypeDef


session = Session()

client: TimestreamQueryClient
async with session.client("timestream-query") as client:  # (1)
    paginator: ListScheduledQueriesPaginator = client.get_paginator("list_scheduled_queries")  # (2)
    async for item in paginator.paginate(...):
        item: ListScheduledQueriesResponseTypeDef
        print(item)  # (3)
  1. client: TimestreamQueryClient
  2. paginator: ListScheduledQueriesPaginator
  3. item: ListScheduledQueriesResponseTypeDef