Type Annotations for aiobotocore RDS
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
- breaking Support for Python 3.8 was removed from `mypy-boto3-builder` version 8.12.0 and consequently from `types-aiobotocore-rds` version 3.x.x. Users on Python 3.8 should upgrade to Python 3.9 or newer.
- breaking Type Definition (TypeDef) naming conventions changed in `mypy-boto3-builder` version 8.9.0. Some TypeDefs for method arguments now use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`), and conflicting `Extra` postfixes were moved (e.g., `CreateDistributionExtraRequestTypeDef` became `CreateDistributionRequestExtraTypeDef`).
- gotcha This package (`types-aiobotocore-rds`) only provides type annotations. You must also install `aiobotocore` (and its dependencies) for the code to run at runtime. Without `aiobotocore`, your code will fail with `ModuleNotFoundError`.
- gotcha PyCharm users might experience slow performance or high CPU usage due to `Literal` overloads (PyCharm issue PY-40997). The project recommends using `types-aiobotocore-lite` as a workaround for this specific IDE issue.
Install
-
pip install types-aiobotocore-rds aiobotocore
Imports
- RDSClient
from types_aiobotocore_rds.client import RDSClient
- DBInstanceTypeDef
from types_aiobotocore_rds.type_defs import DBInstanceTypeDef
Quickstart
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())