Skip to content
Query AWS Athena and download the result as CSV.
Branch: master
Clone or download
Latest commit a9f1b8e Mar 10, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci add ci Mar 9, 2019
.gitignore initial commit Mar 9, 2019
LICENSE Initial commit Mar 9, 2019 Update Mar 10, 2019
go.mod update mod Mar 9, 2019
go.sum update mod Mar 9, 2019
main.go update mod Mar 9, 2019
query.txt simple query Mar 9, 2019



This tool can download an Athena SQL query results in CSV format.


$ go get -u -v

Or you can clone and build:

$ git clone
$ cd athena2csv/
$ go build -v

Run the tool

Running this tool will create an S3 bucket queryathena2csv-query-bucket.

Required environment variables:

# The following should have at least Athena read and S3 read/write access.

If your query string is quite long, you can write it in a file:

$ athena2csv --database aws-billing --query-file query.txt

If your query is not that long, you can input directly in command line:

$ athena2csv --database aws-billing "select \"identity/lineitemid\" \
      from \"aws_billing\".\"mobingilabs_aws_billing_formatted_development\" \
      limit 10"

Output file is downloaded to the current directory, named output.csv.

You can’t perform that action at this time.