Examples#
Index > RedshiftServerless > Examples
Auto-generated documentation for RedshiftServerless type annotations stubs module mypy-boto3-redshift-serverless.
Client#
Implicit type annotations#
Can be used with boto3-stubs[redshift-serverless]
package installed.
Write your RedshiftServerless
code as usual,
type checking and code completion should work out of the box.
# RedshiftServerlessClient usage example
from boto3.session import Session
session = Session()
client = session.client("redshift-serverless") # (1)
result = client.convert_recovery_point_to_snapshot() # (2)
# ListCustomDomainAssociationsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("redshift-serverless") # (1)
paginator = client.get_paginator("list_custom_domain_associations") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: RedshiftServerlessClient
- paginator: ListCustomDomainAssociationsPaginator
- item: ListCustomDomainAssociationsResponseTypeDef
Explicit type annotations#
With boto3-stubs-lite[redshift-serverless]
or a standalone mypy_boto3_redshift_serverless
package, you have to explicitly specify client: RedshiftServerlessClient
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.
# RedshiftServerlessClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_redshift_serverless.client import RedshiftServerlessClient
from mypy_boto3_redshift_serverless.type_defs import ConvertRecoveryPointToSnapshotResponseTypeDef
from mypy_boto3_redshift_serverless.type_defs import ConvertRecoveryPointToSnapshotRequestRequestTypeDef
session = Session()
client: RedshiftServerlessClient = session.client("redshift-serverless")
kwargs: ConvertRecoveryPointToSnapshotRequestRequestTypeDef = {...}
result: ConvertRecoveryPointToSnapshotResponseTypeDef = client.convert_recovery_point_to_snapshot(**kwargs)
# ListCustomDomainAssociationsPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_redshift_serverless.client import RedshiftServerlessClient
from mypy_boto3_redshift_serverless.paginator import ListCustomDomainAssociationsPaginator
from mypy_boto3_redshift_serverless.type_defs import ListCustomDomainAssociationsResponseTypeDef
session = Session()
client: RedshiftServerlessClient = session.client("redshift-serverless")
paginator: ListCustomDomainAssociationsPaginator = client.get_paginator("list_custom_domain_associations")
for item in paginator.paginate(...):
item: ListCustomDomainAssociationsResponseTypeDef
print(item)