{"id":21823,"library":"pythena","title":"PyThenA - Simple Athena Wrapper","description":"A simple Amazon Athena wrapper leveraging boto3 to execute queries and return results. Requires only a database and query string. Current version 1.6.0, last updated 2021-06-28, no recent releases.","status":"active","version":"1.6.0","language":"python","source_language":"en","source_url":"https://github.com/chrispruitt/pythena","tags":["aws","athena","query","boto3","wrapper"],"install":[{"cmd":"pip install pythena","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Required for AWS Athena client","package":"boto3","optional":false}],"imports":[{"note":"Correct import path","wrong":"","symbol":"PyThenA","correct":"from pythena import PyThenA"}],"quickstart":{"code":"from pythena import PyThenA\nimport os\n\ndatabase = os.environ.get('ATHENA_DATABASE', 'default')\nquery = \"SELECT 1 AS test\"\n\nclient = PyThenA(database=database)\nresult = client.execute(query)\nprint(result.data)","lang":"python","description":"Basic usage: create PyThenA instance with database, execute query, access result.data as a list of dicts."},"warnings":[{"fix":"Access result.data for query results.","message":"The execute() method returns a Result object with .data (list of dicts) and .columns (list of column names). Do not expect raw dicts directly.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider using boto3 directly or awswrangler for Athena queries.","message":"The library has not been updated since 2021. boto3 API changes may cause incompatibility with newer AWS API versions.","severity":"deprecated","affected_versions":">=1.6.0"},{"fix":"client = PyThenA(database='mydb', output_location='s3://my-bucket/path/')","message":"The PyThenA constructor defaults to 'default' output location 's3://aws-athena-query-results-{account_id}-{region}/'. If your bucket has a different pattern, set output_location explicitly.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use exact case: from pythena import PyThenA","cause":"Misspelling or using wrong case.","error":"ImportError: cannot import name 'PyThenA' from 'pythena'"},{"fix":"Set max_results or use the asynchronous execute_and_wait method with custom timeout.","cause":"Query takes longer than default timeout (300 seconds).","error":"botocore.errorfactory.InvalidRequestException: An error occurred (InvalidRequestException) when calling the StartQueryExecution operation: Query timeout"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}