athena-cli


Nameathena-cli JSON
Version 0.1.13 PyPI version JSON
download
home_pagehttps://github.com/satterly/athena-cli
SummaryPresto-like CLI for AWS Athena
upload_time2023-06-17 07:15:11
maintainer
docs_urlNone
authorNick Satterly
requires_python>=3.5
licenseApache License 2.0
keywords aws athena presto cli
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Athena CLI
==========

[![Build Status](https://travis-ci.org/guardian/athena-cli.svg?branch=master)](https://travis-ci.org/guardian/athena-cli)

Presto-like CLI tool for [AWS Athena](https://aws.amazon.com/athena/). The alternative is using the
AWS CLI [Athena sub-commands](http://docs.aws.amazon.com/cli/latest/reference/athena/).

[![asciicast](https://asciinema.org/a/132545.png)](https://asciinema.org/a/132545)

Requirements
------------

A recent version of the `aws` CLI must be available on the PATH.

Installation
------------

To install using `pip` run:

    $ pip install athena-cli

Or, clone the GitHub repo and run:

    $ python setup.py install

Configuration
-------------

Only required configuration is AWS credentials.

Usage
-----

```
$ athena --help
usage: athena [--debug] [--execute <statement>] [--output-format <format>] [--schema <schema>]
              [--profile <profile>] [--region <region>] [--s3-bucket <bucket>]
              [--server-side-encryption] [--version]

Athena interactive console

optional arguments:
  -h, --help            show this help message and exit
  --debug               enable debug mode
  --execute STATEMENT   execute statement in batch mode
  --output-format {ALIGNED,VERTICAL,CSV,TSV,CSV_HEADER,TSV_HEADER,NULL}
                        output format for batch mode
  --schema SCHEMA, --database SCHEMA, --db SCHEMA
                        default schema
  --profile PROFILE     AWS profile
  --region REGION       AWS region
  --s3-bucket BUCKET, --bucket BUCKET
                        AWS S3 bucket for query results
  --server-side-encryption, --encryption
                        Use server-side-encryption for query results
  --version             show version info and exit
```

```
athena> help

Supported commands:
QUIT
SELECT
ALTER DATABASE <schema>
ALTER TABLE <table>
CREATE DATABASE <schema>
CREATE TABLE <table>
CREATE TABLE <table> AS <query>
CREATE [OR REPLACE] VIEW <view> AS <query>
DESCRIBE <table>
DROP DATABASE <schema>
DROP TABLE <table>
MSCK REPAIR TABLE <table>
SHOW COLUMNS FROM <table>
SHOW CREATE TABLE <table>
SHOW DATABASES [LIKE <pattern>]
SHOW PARTITIONS <table>
SHOW TABLES [IN <schema>] [<pattern>]
SHOW TBLPROPERTIES <table>
USE [<catalog>.]<schema>
VALUES row [, ...]
```

See http://docs.aws.amazon.com/athena/latest/ug/language-reference.html

Example
-------

```
athena> use sampledb;
athena:sampledb> show tables;
 tab_name
------------
 elb_logs
(1 rows)

Query deb156b5-293e-472d-8897-5ee195b06b11, SUCCEEDED
https://eu-west-1.console.aws.amazon.com/athena/home?force&region=eu-west-1#query/history/deb156b5-293e-472d-8897-5ee195b06b11
Time: 0:00:00, CPU Time: 474ms total, Data Scanned: 0.00B, Cost: $0.00
```

Troubleshooting
---------------

Use the `--debug` option when launching the `athena` CLI to get AWS debug output:

```shell
$ athena --debug
2017-07-21 10:10:45,477 botocore.credentials [DEBUG] Looking for credentials via: env
2017-07-21 10:10:45,478 botocore.credentials [DEBUG] Looking for credentials via: assume-role
2017-07-21 10:10:45,478 botocore.credentials [DEBUG] Looking for credentials via: shared-credentials-file
2017-07-21 10:10:45,479 botocore.credentials [INFO] Found credentials in shared credentials file: ~/.aws/credentials
...
```

Turn on debug at the `athena>` prompt by typing:

```
athena> set debug true
debug - was: False
now: True
```

Command history is written to `~/.athena_history`.

Similar Projects
----------------

- [AthenaCLI](dbcli/athenacli): CLI tool for AWS Athena service that can do auto-completion and syntax highlighting.
- [athena-cli (Ruby)](pengwynn/athena-cli): CLI for Amazon Athena, powered by JRuby.

References
----------

  * AWS Athena: https://aws.amazon.com/athena/
  * AWS SDK for Python: https://boto3.readthedocs.io/en/latest/reference/services/athena.html
  * PrestoDB: https://prestodb.io/docs/current/

License
-------

    Athena CLI
    Copyright 2017-2018 Guardian News & Media
    Copyright 2019,2023 Nick Satterly

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/satterly/athena-cli",
    "name": "athena-cli",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": "",
    "keywords": "aws athena presto cli",
    "author": "Nick Satterly",
    "author_email": "nick.satterly@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ad/a5/a3b3a743b32a8479fa96d1c95c2d5bb8d42d8bcb487d530c26f2ce07ba84/athena-cli-0.1.13.tar.gz",
    "platform": null,
    "description": "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 <statement>] [--output-format <format>] [--schema <schema>]\n              [--profile <profile>] [--region <region>] [--s3-bucket <bucket>]\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 {ALIGNED,VERTICAL,CSV,TSV,CSV_HEADER,TSV_HEADER,NULL}\n                        output format for batch mode\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> help\n\nSupported commands:\nQUIT\nSELECT\nALTER DATABASE <schema>\nALTER TABLE <table>\nCREATE DATABASE <schema>\nCREATE TABLE <table>\nCREATE TABLE <table> AS <query>\nCREATE [OR REPLACE] VIEW <view> AS <query>\nDESCRIBE <table>\nDROP DATABASE <schema>\nDROP TABLE <table>\nMSCK REPAIR TABLE <table>\nSHOW COLUMNS FROM <table>\nSHOW CREATE TABLE <table>\nSHOW DATABASES [LIKE <pattern>]\nSHOW PARTITIONS <table>\nSHOW TABLES [IN <schema>] [<pattern>]\nSHOW TBLPROPERTIES <table>\nUSE [<catalog>.]<schema>\nVALUES row [, ...]\n```\n\nSee http://docs.aws.amazon.com/athena/latest/ug/language-reference.html\n\nExample\n-------\n\n```\nathena> use sampledb;\nathena:sampledb> 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&region=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>` prompt by typing:\n\n```\nathena> set debug true\ndebug - was: False\nnow: True\n```\n\nCommand history is written to `~/.athena_history`.\n\nSimilar Projects\n----------------\n\n- [AthenaCLI](dbcli/athenacli): CLI tool for AWS Athena service that can do auto-completion and syntax highlighting.\n- [athena-cli (Ruby)](pengwynn/athena-cli): CLI for Amazon Athena, powered by JRuby.\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 & Media\n    Copyright 2019,2023 Nick Satterly\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",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Presto-like CLI for AWS Athena",
    "version": "0.1.13",
    "project_urls": {
        "Homepage": "https://github.com/satterly/athena-cli"
    },
    "split_keywords": [
        "aws",
        "athena",
        "presto",
        "cli"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b73d3160d3fde379359c77f612c82267c4c425bbe799e439883b2a7cf8c019f8",
                "md5": "e17832d9c9290d4d5b23143c856c7b99",
                "sha256": "cbcff80ae80faef1e0c649225c8ae7a2326a4e635a254bfb77bb911c2bd20469"
            },
            "downloads": -1,
            "filename": "athena_cli-0.1.13-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e17832d9c9290d4d5b23143c856c7b99",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.5",
            "size": 12851,
            "upload_time": "2023-06-17T07:15:09",
            "upload_time_iso_8601": "2023-06-17T07:15:09.787976Z",
            "url": "https://files.pythonhosted.org/packages/b7/3d/3160d3fde379359c77f612c82267c4c425bbe799e439883b2a7cf8c019f8/athena_cli-0.1.13-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ada5a3b3a743b32a8479fa96d1c95c2d5bb8d42d8bcb487d530c26f2ce07ba84",
                "md5": "ea8416552d4430d39c2e6356dac59c36",
                "sha256": "f84a3766aee9ef4df982c251faa640c9961b091724b52e01b2e32fdc31bbdaaf"
            },
            "downloads": -1,
            "filename": "athena-cli-0.1.13.tar.gz",
            "has_sig": false,
            "md5_digest": "ea8416552d4430d39c2e6356dac59c36",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 11250,
            "upload_time": "2023-06-17T07:15:11",
            "upload_time_iso_8601": "2023-06-17T07:15:11.201170Z",
            "url": "https://files.pythonhosted.org/packages/ad/a5/a3b3a743b32a8479fa96d1c95c2d5bb8d42d8bcb487d530c26f2ce07ba84/athena-cli-0.1.13.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-17 07:15:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "satterly",
    "github_project": "athena-cli",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "athena-cli"
}
        
Elapsed time: 0.09209s