{"library":"mypy-boto3-rds","code":"import boto3\nfrom typing import TYPE_CHECKING\n\n# It is generally recommended to install 'boto3-stubs[rds]' for full integration.\n# For explicit type annotation of the client:\nif TYPE_CHECKING:\n    from mypy_boto3_rds.client import RDSClient\n    from mypy_boto3_rds.type_defs import DescribeDBInstancesMessageTypeDef\n\n    # Example of a Paginator\n    from mypy_boto3_rds.paginators import DescribeDBInstancesPaginator\n\n\n# Initialize boto3 client\n# For better type inference, explicitly annotate the client if TYPE_CHECKING is True\nclient: RDSClient = boto3.client(\"rds\") if TYPE_CHECKING else boto3.client(\"rds\")\n\ntry:\n    # Example API call with type-hinted response\n    response = client.describe_db_instances(\n        MaxRecords=20\n    )\n    # The 'response' object will have type hints based on DescribeDBInstancesMessageTypeDef\n    print(f\"Found {len(response.get('DBInstances', []))} DB instances.\")\n\n    # Example usage of a Paginator\n    paginator: DescribeDBInstancesPaginator = client.get_paginator(\"describe_db_instances\")\n    for page in paginator.paginate():\n        print(f\"Processing page with {len(page.get('DBInstances', []))} instances.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to use `mypy-boto3-rds` for type-hinting a `boto3` RDS client. It shows explicit type annotation for the client, an API call with type-hinted response, and usage of a paginator. The `TYPE_CHECKING` block ensures that type-only imports do not affect runtime dependencies. Note that `boto3-stubs[rds]` is the idiomatic way to install type annotations for a specific service.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":1},{"runtime":"python:3.10-slim","exit_code":1},{"runtime":"python:3.11-alpine","exit_code":1},{"runtime":"python:3.11-slim","exit_code":1},{"runtime":"python:3.12-alpine","exit_code":1},{"runtime":"python:3.12-slim","exit_code":1},{"runtime":"python:3.13-alpine","exit_code":1},{"runtime":"python:3.13-slim","exit_code":1},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}