Skip to content

Examples#

Index > AuroraDSQL > Examples

Auto-generated documentation for AuroraDSQL type annotations stubs module types-boto3-dsql.

Client#

Implicit type annotations#

Can be used with types-boto3[dsql] package installed.

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

Client method usage example#

# AuroraDSQLClient usage example

from boto3.session import Session


session = Session()

client = session.client("dsql")  # (1)
result = client.create_cluster()  # (2)
  1. client: AuroraDSQLClient
  2. result: CreateClusterOutputTypeDef

Paginator usage example#

# ListClustersPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("dsql")  # (1)

paginator = client.get_paginator("list_clusters")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: AuroraDSQLClient
  2. paginator: ListClustersPaginator
  3. item: ListClustersOutputTypeDef

Waiter usage example#

# ClusterActiveWaiter usage example

from boto3.session import Session


session = Session()
client = session.client("dsql")  # (1)

waiter = client.get_waiter("cluster_active")  # (2)
waiter.wait(...)
  1. client: AuroraDSQLClient
  2. waiter: ClusterActiveWaiter

Explicit type annotations#

With types-boto3-lite[dsql] or a standalone types_boto3_dsql package, you have to explicitly specify client: AuroraDSQLClient 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 method usage example#

# AuroraDSQLClient usage example with type annotations

from boto3.session import Session

from types_boto3_dsql.client import AuroraDSQLClient
from types_boto3_dsql.type_defs import CreateClusterOutputTypeDef
from types_boto3_dsql.type_defs import CreateClusterInputTypeDef


session = Session()

client: AuroraDSQLClient = session.client("dsql")

kwargs: CreateClusterInputTypeDef = {...}
result: CreateClusterOutputTypeDef = client.create_cluster(**kwargs)

Paginator usage example#

# ListClustersPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_dsql.client import AuroraDSQLClient
from types_boto3_dsql.paginator import ListClustersPaginator
from types_boto3_dsql.type_defs import ListClustersOutputTypeDef


session = Session()
client: AuroraDSQLClient = session.client("dsql")

paginator: ListClustersPaginator = client.get_paginator("list_clusters")
for item in paginator.paginate(...):
    item: ListClustersOutputTypeDef
    print(item)

Waiter usage example#

# ClusterActiveWaiter usage example with type annotations

from boto3.session import Session

from types_boto3_dsql.client import AuroraDSQLClient
from types_boto3_dsql.waiter import ClusterActiveWaiter

session = Session()
client: AuroraDSQLClient = session.client("dsql")

waiter: ClusterActiveWaiter = client.get_waiter("cluster_active")
waiter.wait(...)