Skip to content

Examples#

Index > RDS > Examples

Auto-generated documentation for RDS type annotations stubs module types-aiobotocore-rds.

Client#

Implicit type annotations#

Can be used with types-aiobotocore[rds] package installed.

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

# RDSClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("rds") as client:  # (1)
    result = await client.add_role_to_db_cluster()  # (2)
  1. client: RDSClient
  2. result: EmptyResponseMetadataTypeDef
# DescribeBlueGreenDeploymentsPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("rds") as client:  # (1)
    paginator = client.get_paginator("describe_blue_green_deployments")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: RDSClient
  2. paginator: DescribeBlueGreenDeploymentsPaginator
  3. item: DescribeBlueGreenDeploymentsResponseTypeDef
# DBClusterAvailableWaiter usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("rds") as client:  # (1)
    waiter = client.get_waiter("db_cluster_available")  # (2)
    await waiter.wait()
  1. client: RDSClient
  2. waiter: DBClusterAvailableWaiter

Explicit type annotations#

With types-aiobotocore-lite[rds] or a standalone types_aiobotocore_rds package, you have to explicitly specify client: RDSClient 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.

# RDSClient usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_rds.client import RDSClient
from types_aiobotocore_rds.type_defs import EmptyResponseMetadataTypeDef
from types_aiobotocore_rds.type_defs import AddRoleToDBClusterMessageRequestTypeDef


session = get_session()

async with session.create_client("rds") as client:
    client: RDSClient
    kwargs: AddRoleToDBClusterMessageRequestTypeDef = {...}
    result: EmptyResponseMetadataTypeDef = await client.add_role_to_db_cluster(**kwargs)
# DescribeBlueGreenDeploymentsPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_rds.client import RDSClient
from types_aiobotocore_rds.paginator import DescribeBlueGreenDeploymentsPaginator
from types_aiobotocore_rds.type_defs import DescribeBlueGreenDeploymentsResponseTypeDef


session = get_session()

async with session.create_client("rds") as client:
    client: RDSClient
    paginator: DescribeBlueGreenDeploymentsPaginator = client.get_paginator("describe_blue_green_deployments")
    async for item in paginator.paginate(...):
        item: DescribeBlueGreenDeploymentsResponseTypeDef
        print(item)
# DBClusterAvailableWaiter usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_rds.client import RDSClient
from types_aiobotocore_rds.waiter import DBClusterAvailableWaiter


session = get_session()

async with session.create_client("rds") as client:
    client: RDSClient
    waiter: DBClusterAvailableWaiter = client.get_waiter("db_cluster_available")
    await waiter.wait()