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.
# AuroraDSQLClient usage example
from boto3.session import Session
session = Session()
client = session.client("dsql") # (1)
result = client.create_cluster() # (2)
- client: AuroraDSQLClient
- result: CreateClusterOutputTypeDef
# 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
# 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.
# 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 CreateClusterInputRequestTypeDef
session = Session()
client: AuroraDSQLClient = session.client("dsql")
kwargs: CreateClusterInputRequestTypeDef = {...}
result: CreateClusterOutputTypeDef = client.create_cluster(**kwargs)
# 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)
# 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()