{"id":1574,"library":"mypy-boto3-redshift-data","title":"mypy-boto3-redshift-data Type Stubs","description":"mypy-boto3-redshift-data provides high-quality type annotations for the `boto3` RedshiftDataAPIService, enhancing developer experience with static type checking for AWS interactions. It's part of the `mypy-boto3` ecosystem, which generates stubs for all `boto3` services. Releases are frequent, typically following new `boto3` versions and `mypy-boto3-builder` updates.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["boto3","aws","type-hints","mypy","redshift-data","type-stubs"],"install":[{"cmd":"pip install mypy-boto3-redshift-data","lang":"bash","label":"Install library"}],"dependencies":[{"reason":"Provides the runtime client for which these type stubs are generated.","package":"boto3","optional":false}],"imports":[{"note":"Import the typed client from the `mypy-boto3` stub package, not directly from `boto3`.","wrong":"from boto3.client import RedshiftDataClient","symbol":"RedshiftDataClient","correct":"from mypy_boto3_redshift_data import RedshiftDataClient"},{"note":"Type definitions (TypedDicts) are found in the `type_defs` submodule.","symbol":"ExecuteStatementResponseTypeDef","correct":"from mypy_boto3_redshift_data.type_defs import ExecuteStatementResponseTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_redshift_data import RedshiftDataClient\nfrom mypy_boto3_redshift_data.type_defs import ExecuteStatementResponseTypeDef\nimport os\n\n# Instantiate the boto3 client, which will be augmented with type hints\n# from mypy-boto3-redshift-data for static analysis.\nclient: RedshiftDataClient = boto3.client(\"redshift-data\")\n\n# Example of executing a Redshift Data API statement.\n# Replace with your actual cluster, database, and SQL for a successful run.\ncluster_identifier = os.environ.get(\"REDSHIFT_CLUSTER_IDENTIFIER\", \"your-redshift-cluster-identifier\")\ndatabase = os.environ.get(\"REDSHIFT_DATABASE\", \"dev\")\ndb_user = os.environ.get(\"REDSHIFT_DB_USER\", \"awsuser\")\nsql_statement = \"SELECT 1;\" # A simple, safe statement\n\ntry:\n    # mypy will check arguments and the response type\n    response: ExecuteStatementResponseTypeDef = client.execute_statement(\n        ClusterIdentifier=cluster_identifier,\n        Database=database,\n        DbUser=db_user,\n        Sql=sql_statement,\n        WithEvent=False # Example of an optional parameter with type checking\n    )\n    print(f\"Statement ID: {response['Id']}\")\n    # Accessing an optional key safely with .get()\n    print(f\"Statement status: {response.get('Status', 'UNKNOWN')}\")\n\n    # Mypy would flag if you tried to access 'response[\"NonExistentKey\"]'\n    # or used a wrong type for an argument to client.execute_statement.\n\nexcept Exception as e:\n    print(f\"Error executing statement: {e}\")\n    print(\"Please ensure environment variables REDSHIFT_CLUSTER_IDENTIFIER, REDSHIFT_DATABASE, REDSHIFT_DB_USER are set if expecting a successful execution.\")\n\nprint(\"\\nType checking for RedshiftDataClient is enabled.\")\n","lang":"python","description":"This quickstart demonstrates how to initialize a `boto3` RedshiftData client and use it with type hints provided by `mypy-boto3-redshift-data`. It includes an example `execute_statement` call, showcasing how input arguments and output responses benefit from static type checking. Remember to install `boto3` separately."},"warnings":[{"fix":"Upgrade your project's Python version to 3.9 or higher.","message":"Starting with version 8.12.0 of `mypy-boto3-builder` (which generates this stub), support for Python 3.8 has been removed. Projects using these stubs must target Python 3.9 or newer.","severity":"breaking","affected_versions":"8.12.0+"},{"fix":"Review your code for TypeDef imports and adjust names according to the new conventions (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`).","message":"Version 8.9.0 introduced changes to TypedDict naming conventions to improve consistency and resolve conflicts. Some TypeDef names may have been shortened or have `Extra` moved to the end.","severity":"breaking","affected_versions":"8.9.0+"},{"fix":"Ensure `boto3` is installed in your environment: `pip install boto3`.","message":"This package provides only type stubs and does not include the `boto3` runtime library itself. `boto3` must be installed separately for your code to execute.","severity":"gotcha","affected_versions":"All"},{"fix":"Align `mypy-boto3-redshift-data` and `boto3` versions, e.g., `pip install 'boto3==1.42.3' 'mypy-boto3-redshift-data==1.42.3'` (replace with desired versions).","message":"For the most accurate type checking, the version of `mypy-boto3-redshift-data` should ideally match or be close to your installed `boto3` version, as stubs are generated for specific `boto3` releases.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}