Type Annotations for aiobotocore RDS

3.4.0 · active · verified Sat Apr 11

types-aiobotocore-rds provides static type annotations for the aiobotocore RDS service. It enables robust type checking and improved code completion for asynchronous AWS interactions in tools like VSCode, PyCharm, mypy, and pyright. This package is generated by the mypy-boto3-builder project and is currently at version 3.4.0, generated with builder version 8.12.0, with ongoing active development.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use `types-aiobotocore-rds` to add type annotations to an `aiobotocore` RDS client. It fetches and prints details of RDS DB instances using explicit type hints for the client and the response payload, ensuring better type checking and IDE support. Remember to set up AWS credentials for the code to execute successfully.

import asyncio
from typing import TYPE_CHECKING

import aiobotocore.session

if TYPE_CHECKING:
    from types_aiobotocore_rds.client import RDSClient
    from types_aiobotocore_rds.type_defs import DBInstanceMessageTypeDef


async def describe_rds_instances():
    session = aiobotocore.session.get_session()
    async with session.create_client("rds") as client:
        if TYPE_CHECKING:
            client: RDSClient # Explicit type annotation for the client

        print("Describing RDS DB instances...")
        response: DBInstanceMessageTypeDef = await client.describe_db_instances()

        for db_instance in response.get("DBInstances", []):
            print(f"  DB Instance Identifier: {db_instance.get('DBInstanceIdentifier')}")
            print(f"  DB Instance Status: {db_instance.get('DBInstanceStatus')}")
            print(f"  Engine: {db_instance.get('Engine')}")
            print(f"  Endpoint: {db_instance.get('Endpoint', {}).get('Address')}:{db_instance.get('Endpoint', {}).get('Port')}")

        print("Description complete.")

if __name__ == "__main__":
    asyncio.run(describe_rds_instances())

view raw JSON →