Examples#
Auto-generated documentation for Redshift type annotations stubs module types-boto3-redshift.
Client#
Implicit type annotations#
Can be used with types-boto3[redshift]
package installed.
Write your Redshift
code as usual,
type checking and code completion should work out of the box.
Client method usage example#
# RedshiftClient usage example
from boto3.session import Session
session = Session()
client = session.client("redshift") # (1)
result = client.accept_reserved_node_exchange() # (2)
- client: RedshiftClient
- result: AcceptReservedNodeExchangeOutputMessageTypeDef
Paginator usage example#
# DescribeClusterDbRevisionsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("redshift") # (1)
paginator = client.get_paginator("describe_cluster_db_revisions") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: RedshiftClient
- paginator: DescribeClusterDbRevisionsPaginator
- item: ClusterDbRevisionsMessageTypeDef
Waiter usage example#
# ClusterAvailableWaiter usage example
from boto3.session import Session
session = Session()
client = session.client("redshift") # (1)
waiter = client.get_waiter("cluster_available") # (2)
waiter.wait(...)
- client: RedshiftClient
- waiter: ClusterAvailableWaiter
Explicit type annotations#
With types-boto3-lite[redshift]
or a standalone types_boto3_redshift
package, you have to explicitly specify client: RedshiftClient
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#
# RedshiftClient usage example with type annotations
from boto3.session import Session
from types_boto3_redshift.client import RedshiftClient
from types_boto3_redshift.type_defs import AcceptReservedNodeExchangeOutputMessageTypeDef
from types_boto3_redshift.type_defs import AcceptReservedNodeExchangeInputMessageTypeDef
session = Session()
client: RedshiftClient = session.client("redshift")
kwargs: AcceptReservedNodeExchangeInputMessageTypeDef = {...}
result: AcceptReservedNodeExchangeOutputMessageTypeDef = client.accept_reserved_node_exchange(**kwargs)
Paginator usage example#
# DescribeClusterDbRevisionsPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_redshift.client import RedshiftClient
from types_boto3_redshift.paginator import DescribeClusterDbRevisionsPaginator
from types_boto3_redshift.type_defs import ClusterDbRevisionsMessageTypeDef
session = Session()
client: RedshiftClient = session.client("redshift")
paginator: DescribeClusterDbRevisionsPaginator = client.get_paginator("describe_cluster_db_revisions")
for item in paginator.paginate(...):
item: ClusterDbRevisionsMessageTypeDef
print(item)
Waiter usage example#
# ClusterAvailableWaiter usage example with type annotations
from boto3.session import Session
from types_boto3_redshift.client import RedshiftClient
from types_boto3_redshift.waiter import ClusterAvailableWaiter
session = Session()
client: RedshiftClient = session.client("redshift")
waiter: ClusterAvailableWaiter = client.get_waiter("cluster_available")
waiter.wait(...)