{"id":13821277,"url":"https://github.com/guardian/athena-cli","last_synced_at":"2025-05-16T12:33:04.031Z","repository":{"id":59966941,"uuid":"97880531","full_name":"guardian/athena-cli","owner":"guardian","description":"Presto-like CLI tool for AWS Athena","archived":true,"fork":false,"pushed_at":"2022-10-11T08:31:36.000Z","size":67,"stargazers_count":84,"open_issues_count":7,"forks_count":15,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-05-11T19:46:01.666Z","etag":null,"topics":["misc"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guardian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-20T21:42:32.000Z","updated_at":"2025-03-22T11:09:02.000Z","dependencies_parsed_at":"2023-01-19T18:40:20.895Z","dependency_job_id":null,"html_url":"https://github.com/guardian/athena-cli","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guardian%2Fathena-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guardian%2Fathena-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guardian%2Fathena-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guardian%2Fathena-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guardian","download_url":"https://codeload.github.com/guardian/athena-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254530639,"owners_count":22086651,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["misc"],"created_at":"2024-08-04T08:01:19.035Z","updated_at":"2025-05-16T12:33:03.046Z","avatar_url":"https://github.com/guardian.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"Athena CLI\n==========\n\n[![Build Status](https://travis-ci.org/guardian/athena-cli.svg?branch=master)](https://travis-ci.org/guardian/athena-cli)\n\nPresto-like CLI tool for [AWS Athena](https://aws.amazon.com/athena/). The alternative is using the\nAWS CLI [Athena sub-commands](http://docs.aws.amazon.com/cli/latest/reference/athena/).\n\n[![asciicast](https://asciinema.org/a/132545.png)](https://asciinema.org/a/132545)\n\nRequirements\n------------\n\nA recent version of the `aws` CLI must be available on the PATH.\n\nInstallation\n------------\n\nTo install using `pip` run:\n\n    $ pip install athena-cli\n\nOr, clone the GitHub repo and run:\n\n    $ python setup.py install\n\nConfiguration\n-------------\n\nOnly required configuration is AWS credentials.\n\nUsage\n-----\n\n```\n$ athena --help\nusage: athena [--debug] [--execute \u003cstatement\u003e] [--output-format \u003cformat\u003e] [--schema \u003cschema\u003e]\n              [--profile \u003cprofile\u003e] [--region \u003cregion\u003e] [--s3-bucket \u003cbucket\u003e]\n              [--server-side-encryption] [--version]\n\nAthena interactive console\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --debug               enable debug mode\n  --execute STATEMENT   execute statement in batch mode\n  --output-format FORMAT\n                        output format for batch mode [ALIGNED, VERTICAL, CSV,\n                        TSV, CSV_HEADER, TSV_HEADER, NULL]\n  --schema SCHEMA, --database SCHEMA, --db SCHEMA\n                        default schema\n  --profile PROFILE     AWS profile\n  --region REGION       AWS region\n  --s3-bucket BUCKET, --bucket BUCKET\n                        AWS S3 bucket for query results\n  --server-side-encryption, --encryption\n                        Use server-side-encryption for query results\n  --version             show version info and exit\n```\n\n```\nathena\u003e help\n\nSupported commands:\nQUIT\nSELECT\nALTER DATABASE \u003cschema\u003e\nALTER TABLE \u003ctable\u003e\nCREATE DATABASE \u003cschema\u003e\nCREATE TABLE \u003ctable\u003e\nDESCRIBE \u003ctable\u003e\nDROP DATABASE \u003cschema\u003e\nDROP TABLE \u003ctable\u003e\nMSCK REPAIR TABLE \u003ctable\u003e\nSHOW COLUMNS FROM \u003ctable\u003e\nSHOW CREATE TABLE \u003ctable\u003e\nSHOW DATABASES [LIKE \u003cpattern\u003e]\nSHOW PARTITIONS \u003ctable\u003e\nSHOW TABLES [IN \u003cschema\u003e] [\u003cpattern\u003e]\nSHOW TBLPROPERTIES \u003ctable\u003e\nUSE [\u003ccatalog\u003e.]\u003cschema\u003e\nVALUES row [, ...]\n```\n\nSee http://docs.aws.amazon.com/athena/latest/ug/language-reference.html\n\nExample\n-------\n\n```\nathena\u003e use sampledb;\nathena:sampledb\u003e show tables;\n tab_name\n------------\n elb_logs\n(1 rows)\n\nQuery deb156b5-293e-472d-8897-5ee195b06b11, SUCCEEDED\nhttps://eu-west-1.console.aws.amazon.com/athena/home?force\u0026region=eu-west-1#query/history/deb156b5-293e-472d-8897-5ee195b06b11\nTime: 0:00:00, CPU Time: 474ms total, Data Scanned: 0.00B, Cost: $0.00\n```\n\nTroubleshooting\n---------------\n\nUse the `--debug` option when launching the `athena` CLI to get AWS debug output:\n\n```shell\n$ athena --debug\n2017-07-21 10:10:45,477 botocore.credentials [DEBUG] Looking for credentials via: env\n2017-07-21 10:10:45,478 botocore.credentials [DEBUG] Looking for credentials via: assume-role\n2017-07-21 10:10:45,478 botocore.credentials [DEBUG] Looking for credentials via: shared-credentials-file\n2017-07-21 10:10:45,479 botocore.credentials [INFO] Found credentials in shared credentials file: ~/.aws/credentials\n...\n```\n\nTurn on debug at the `athena\u003e` prompt by typing:\n\n```\nathena\u003e set debug true\ndebug - was: False\nnow: True\n```\n\nThe below error means the version of `aws` CLI is not recent enough. Upgrade\nto version 1.10.18 or higher:\n\n```\nCommand 'aws sts get-caller-identity --output text --query 'Account' --profile default' returned non-zero exit status 2\n```\n\nCommand history is written to `~/.athena_history`.\n\nReferences\n----------\n\n  * AWS Athena: https://aws.amazon.com/athena/\n  * AWS SDK for Python: https://boto3.readthedocs.io/en/latest/reference/services/athena.html\n  * PrestoDB: https://prestodb.io/docs/current/\n\nLicense\n-------\n\n    Athena CLI\n    Copyright 2017-2018 Guardian News \u0026 Media\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguardian%2Fathena-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguardian%2Fathena-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguardian%2Fathena-cli/lists"}