Examples#
Index > AuroraDSQL > Examples
Auto-generated documentation for AuroraDSQL type annotations stubs module mypy-boto3-dsql.
Client#
Implicit type annotations#
Can be used with boto3-stubs[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)
- client: AuroraDSQLClient
- 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)
- client: AuroraDSQLClient
- paginator: ListClustersPaginator
- 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(...)
- client: AuroraDSQLClient
- waiter: ClusterActiveWaiter
Explicit type annotations#
With boto3-stubs-lite[dsql]
or a standalone mypy_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 mypy_boto3_dsql.client import AuroraDSQLClient
from mypy_boto3_dsql.type_defs import CreateClusterOutputTypeDef
from mypy_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 mypy_boto3_dsql.client import AuroraDSQLClient
from mypy_boto3_dsql.paginator import ListClustersPaginator
from mypy_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 mypy_boto3_dsql.client import AuroraDSQLClient
from mypy_boto3_dsql.waiter import ClusterActiveWaiter
session = Session()
client: AuroraDSQLClient = session.client("dsql")
waiter: ClusterActiveWaiter = client.get_waiter("cluster_active")
waiter.wait(...)