Skip to content

Examples#

Index > TimestreamWrite > Examples

Auto-generated documentation for TimestreamWrite type annotations stubs module types-aiobotocore-timestream-write.

Client#

Implicit type annotations#

Can be used with types-aioboto3[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 aioboto3.session import Session


session = Session()

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

Explicit type annotations#

With types-aioboto3-lite[timestream-write] or a standalone types_aiobotocore_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 aioboto3.session import Session

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


session = Session()

client: TimestreamWriteClient
async with session.client("timestream-write") as client:  # (1)
    kwargs: CreateBatchLoadTaskRequestRequestTypeDef = {...}  # (2)
    result: CreateBatchLoadTaskResponseTypeDef = await client.create_batch_load_task(**kwargs)  # (3)
  1. client: TimestreamWriteClient
  2. kwargs: CreateBatchLoadTaskRequestRequestTypeDef
  3. result: CreateBatchLoadTaskResponseTypeDef