{"id":3575,"library":"mypy-boto3-dsql","title":"mypy-boto3-dsql Type Annotations","description":"This package provides machine-generated type annotations for the `boto3` AuroraDSQL service, specifically for `boto3` version 1.42.3. It's part of the `mypy-boto3-builder` ecosystem, designed to bring robust static type checking to `boto3` usage with `mypy`. The project maintains a frequent release cadence, often aligning with new `boto3` versions.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["boto3","mypy","type-checking","aws","dsql","aurora"],"install":[{"cmd":"pip install mypy-boto3-dsql","lang":"bash","label":"Install service stubs"},{"cmd":"pip install boto3 mypy","lang":"bash","label":"Install core dependencies (if not already)"}],"dependencies":[{"reason":"Provides the runtime functionality for which these stubs offer type hints.","package":"boto3","optional":false},{"reason":"The static type checker that utilizes these stubs.","package":"mypy","optional":true}],"imports":[{"symbol":"DSQLClient","correct":"from mypy_boto3_dsql.client import DSQLClient"},{"symbol":"ExecuteStatementRequestRequestTypeDef","correct":"from mypy_boto3_dsql.type_defs import ExecuteStatementRequestRequestTypeDef"},{"symbol":"ExecuteStatementResponseTypeDef","correct":"from mypy_boto3_dsql.type_defs import ExecuteStatementResponseTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_dsql.client import DSQLClient\nfrom mypy_boto3_dsql.type_defs import ExecuteStatementRequestRequestTypeDef, ExecuteStatementResponseTypeDef\nimport os\n\n# Configure AWS credentials and region via environment variables or ~/.aws/credentials\n# For example, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION\n\ndef main():\n    try:\n        # mypy-boto3 stubs ensure type-hinting for boto3 clients\n        client: DSQLClient = boto3.client(\"dsql\", region_name=os.environ.get('AWS_REGION', 'us-east-1'))\n\n        # Example request (adjust parameters as needed for your DSQL setup)\n        request_params: ExecuteStatementRequestRequestTypeDef = {\n            \"dbClusterIdentifier\": \"your-db-cluster-identifier\",\n            \"database\": \"your-database-name\",\n            \"sql\": \"SELECT 1\",\n            \"schema\": \"public\",\n            \"continueAfterTimeout\": False,\n            \"transactionIdentifier\": \"\",\n            \"formatRecords\": True\n        }\n\n        print(\"Executing DSQL statement...\")\n        response: ExecuteStatementResponseTypeDef = client.execute_statement(**request_params)\n\n        print(\"Statement executed successfully!\")\n        print(f\"Response Status: {response.get('responseMetadata', {}).get('HTTPStatusCode')}\")\n        if 'records' in response:\n            print(\"Records returned:\", response['records'])\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n\nif __name__ == \"__main__\":\n    # Set dummy values if env vars are not present for demonstration purposes.\n    # In a real scenario, these should be properly configured.\n    os.environ.setdefault('AWS_ACCESS_KEY_ID', 'AKIAXXXXXXXXXXXXXXXX')\n    os.environ.setdefault('AWS_SECRET_ACCESS_KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')\n    os.environ.setdefault('AWS_REGION', 'us-east-1')\n    main()","lang":"python","description":"This quickstart demonstrates how to initialize a `boto3` DSQL client with `mypy-boto3-dsql` type annotations and execute a simple SQL statement. It highlights how the stubs provide type hints for client methods and their request/response `TypeDef` structures, improving code readability and catching potential errors at development time."},"warnings":[{"fix":"Upgrade your project's Python version to 3.9 or higher. Alternatively, pin `mypy-boto3-dsql` to an older version compatible with Python 3.8.","message":"The `mypy-boto3-builder` (which generates these stubs) dropped support for Python 3.8 in version 8.12.0. Projects using Python 3.8 will need to upgrade to Python 3.9+ to use newer versions of these stubs.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0, mypy-boto3-dsql >= 1.42.3"},{"fix":"If you directly import and use `TypeDef` names, update your import paths and type annotation names according to the new conventions (e.g., by removing redundant 'Request' or adjusting 'Extra' placement). Refer to the `mypy-boto3-builder` release notes for specifics.","message":"Version 8.9.0 of the builder introduced breaking changes to `TypeDef` naming conventions, specifically for packed method arguments and conflicting names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`).","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0, mypy-boto3-dsql >= 1.34.0"},{"fix":"Ensure `boto3` is installed in your project: `pip install boto3`.","message":"These packages provide only type stubs and do not include the `boto3` runtime. `boto3` must be installed separately for your application to function.","severity":"gotcha","affected_versions":"All"},{"fix":"Aim to keep `mypy-boto3-dsql` and `boto3` versions synchronized. When `boto3` is updated, check for a corresponding `mypy-boto3-dsql` release.","message":"For optimal type-checking accuracy, the `mypy-boto3-dsql` package version should ideally match the `boto3` version installed. Mismatched versions can lead to `mypy` errors if there are API differences between the `boto3` runtime and the stub files.","severity":"gotcha","affected_versions":"All"},{"fix":"Regularly consult AWS documentation for service deprecations/changes and the `mypy-boto3-builder` release notes for updates to available stubs. Be prepared to update package names or refactor code if a service's stub package changes.","message":"AWS services can be deprecated, renamed, or have their APIs significantly altered. This can lead to `mypy-boto3` stubs for those services being removed or requiring different package names (e.g., `sms-voice` was replaced by `pinpoint-sms-voice`).","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}