mypy-boto3-timestream-query stubs
mypy-boto3-timestream-query provides type annotations (stubs) for the `boto3` Timestream Query service, enhancing static analysis with tools like MyPy. It is actively maintained by the `youtype/mypy_boto3_builder` project, with versions updated frequently to align with new `boto3` releases and improvements to the builder itself. The current version is 1.42.3.
Warnings
- breaking Python 3.8 support was removed for `mypy-boto3-builder` versions 8.12.0 and later, which includes `mypy-boto3-timestream-query` 1.42.3 and newer. Users on Python 3.8 will encounter installation or runtime errors with these versions.
- breaking The `mypy-boto3-builder` project migrated to PEP 561 compliant namespace packages in version 8.12.0. While largely transparent, this change could affect how type checkers discover packages in complex or non-standard environments.
- gotcha These packages provide *type stubs* for `boto3`, not the `boto3` library itself. You must install `boto3` separately (e.g., `pip install boto3`) for runtime functionality. Without `boto3`, your code will fail at runtime.
- gotcha For accurate type checking, the version of `mypy-boto3-timestream-query` should ideally synchronize with the major and minor version of your installed `boto3` library. Significant mismatches can lead to incorrect or missing type hints.
- breaking In `mypy-boto3-builder` 8.9.0, the naming conventions for some generated TypeDefs were shortened or adjusted to resolve conflicts (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). This may require updates if you directly reference generated TypeDef names in your code.
Install
-
pip install boto3 mypy-boto3-timestream-query -
pip install 'boto3>=1.28.0,<1.29.0' 'mypy-boto3-timestream-query>=1.42.3,<1.43.0'
Imports
- TimestreamQueryClient
from mypy_boto3_timestream_query.client import TimestreamQueryClient
- ListDatabasesResponseTypeDef
from mypy_boto3_timestream_query.type_defs import ListDatabasesResponseTypeDef
Quickstart
import boto3
from mypy_boto3_timestream_query.client import TimestreamQueryClient
from mypy_boto3_timestream_query.type_defs import ListDatabasesResponseTypeDef
# Initialize a boto3 client. Mypy will use the stubs for type checking.
# Ensure AWS credentials are configured (e.g., via environment variables, ~/.aws/credentials)
client: TimestreamQueryClient = boto3.client("timestream-query")
# Example API call with type hinting
try:
print("Attempting to list Timestream databases...")
response: ListDatabasesResponseTypeDef = client.list_databases()
databases = response.get("Databases", [])
if databases:
print("Timestream Databases:")
for db in databases:
print(f"- {db.get('DatabaseName')}")
else:
print("No Timestream databases found.")
except Exception as e:
print(f"Error listing databases: {e}")
print("Ensure you have configured AWS credentials with permissions for Timestream Query.")