Skip to content

Examples#

Index > TimestreamQuery > Examples

Auto-generated documentation for TimestreamQuery type annotations stubs module mypy-boto3-timestream-query.

Client#

Implicit type annotations#

Can be used with boto3-stubs[timestream-query] package installed.

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

# TimestreamQueryClient usage example

from boto3.session import Session


session = Session()

client = session.client("timestream-query")  # (1)
result = client.cancel_query()  # (2)
  1. client: TimestreamQueryClient
  2. result: CancelQueryResponseTypeDef
# ListScheduledQueriesPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("timestream-query")  # (1)

paginator = client.get_paginator("list_scheduled_queries")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: TimestreamQueryClient
  2. paginator: ListScheduledQueriesPaginator
  3. item: ListScheduledQueriesResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[timestream-query] or a standalone mypy_boto3_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.

# TimestreamQueryClient usage example with type annotations

from boto3.session import Session

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


session = Session()

client: TimestreamQueryClient = session.client("timestream-query")

kwargs: CancelQueryRequestRequestTypeDef = {...}
result: CancelQueryResponseTypeDef = client.cancel_query(**kwargs)
# ListScheduledQueriesPaginator usage example with type annotations

from boto3.session import Session

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


session = Session()
client: TimestreamQueryClient = session.client("timestream-query")

paginator: ListScheduledQueriesPaginator = client.get_paginator("list_scheduled_queries")
for item in paginator.paginate(...):
    item: ListScheduledQueriesResponseTypeDef
    print(item)