Install & Compatibility
Where this runs
tested against v1.43.79 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 198.8MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 3.7s · import 0.000s · 267MB
232MB installed
● package 232MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
DSQLClient
✓ from mypy_boto3_dsql import DSQLClient
✗ from mypy_boto3_dsql import DSQLClient
Client
✓ from mypy_boto3_dsql import Client
✗ from mypy_boto3_dsql import DSQLClient
ServiceResource
✓ from mypy_boto3_dsql import ServiceResource
✗ from mypy_boto3_dsql import DSQLClient
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.
import boto3
from mypy_boto3_dsql.client import DSQLClient
from mypy_boto3_dsql.type_defs import ExecuteStatementRequestRequestTypeDef, ExecuteStatementResponseTypeDef
import os
# Configure AWS credentials and region via environment variables or ~/.aws/credentials
# For example, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION
def main():
try:
# mypy-boto3 stubs ensure type-hinting for boto3 clients
client: DSQLClient = boto3.client("dsql", region_name=os.environ.get('AWS_REGION', 'us-east-1'))
# Example request (adjust parameters as needed for your DSQL setup)
request_params: ExecuteStatementRequestRequestTypeDef = {
"dbClusterIdentifier": "your-db-cluster-identifier",
"database": "your-database-name",
"sql": "SELECT 1",
"schema": "public",
"continueAfterTimeout": False,
"transactionIdentifier": "",
"formatRecords": True
}
print("Executing DSQL statement...")
response: ExecuteStatementResponseTypeDef = client.execute_statement(**request_params)
print("Statement executed successfully!")
print(f"Response Status: {response.get('responseMetadata', {}).get('HTTPStatusCode')}")
if 'records' in response:
print("Records returned:", response['records'])
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
# Set dummy values if env vars are not present for demonstration purposes.
# In a real scenario, these should be properly configured.
os.environ.setdefault('AWS_ACCESS_KEY_ID', 'AKIAXXXXXXXXXXXXXXXX')
os.environ.setdefault('AWS_SECRET_ACCESS_KEY', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
os.environ.setdefault('AWS_REGION', 'us-east-1')
main()
Debug
Known issues
breakingThe `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.fixUpgrade your project's Python version to 3.9 or higher. Alternatively, pin `mypy-boto3-dsql` to an older version compatible with Python 3.8.
affects: mypy-boto3-builder >= 8.12.0, mypy-boto3-dsql >= 1.42.3
breakingVersion 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`).fixIf 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.
affects: mypy-boto3-builder >= 8.9.0, mypy-boto3-dsql >= 1.34.0
gotchaThese packages provide only type stubs and do not include the `boto3` runtime. `boto3` must be installed separately for your application to function.fixEnsure `boto3` is installed in your project: `pip install boto3`.
affects: All
gotchaFor 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.fixAim to keep `mypy-boto3-dsql` and `boto3` versions synchronized. When `boto3` is updated, check for a corresponding `mypy-boto3-dsql` release.
affects: All
gotchaAWS 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`).fixRegularly 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.
affects: All
Upgrade
Version history
1.43.79latest on PyPI · released Aug 24, 2026
Audit
Dependencies
boto3requiredProvides the runtime functionality for which these stubs offer type hints.
mypyoptionalThe static type checker that utilizes these stubs.