Skip to content

Examples#

Index > TimestreamWrite > Examples

Auto-generated documentation for TimestreamWrite type annotations stubs module mypy-boto3-timestream-write.

Client#

Implicit type annotations#

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

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

# TimestreamWriteClient usage example

from boto3.session import Session


session = Session()

client = session.client("timestream-write")  # (1)
result = client.create_batch_load_task()  # (2)
  1. client: TimestreamWriteClient
  2. result: CreateBatchLoadTaskResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[timestream-write] or a standalone mypy_boto3_timestream_write package, you have to explicitly specify client: TimestreamWriteClient 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.

# TimestreamWriteClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_timestream_write.client import TimestreamWriteClient
from mypy_boto3_timestream_write.type_defs import CreateBatchLoadTaskResponseTypeDef
from mypy_boto3_timestream_write.type_defs import CreateBatchLoadTaskRequestRequestTypeDef


session = Session()

client: TimestreamWriteClient = session.client("timestream-write")

kwargs: CreateBatchLoadTaskRequestRequestTypeDef = {...}
result: CreateBatchLoadTaskResponseTypeDef = client.create_batch_load_task(**kwargs)