Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute query over Amazon Athena with Ruby?

how to connect Amazon Athena with Ruby and execute query over Amazon Athena and get result.

we not able to find any gem or example with help us to connect Amazon Athena in ruby.

Please provide any reference using which we can use to build connection with Amazon Athena and build a custom query executor in Ruby.

just to clarify my application on production so changing SDK from Ruby to JRuby is not a suitable option for me.

like image 875
jayesh Avatar asked Oct 29 '22 10:10

jayesh


2 Answers

Per May 19th 2017, Amazon Athena supports query execution via SDK and CLI.

Ruby API client for Athena documentation @ docs.aws.amazon.com

Source code of aws-sdk-athena @ github.com/aws/aws-sdk-ruby

like image 114
Petra Barus Avatar answered Nov 15 '22 05:11

Petra Barus


I found that the official Amazon SDK for athena was a bit complicated, so I made a new gem called Athens that wraps the SDK in a nicer interface:

conn = Athens::Connection.new(database: 'sample')
query = conn.execute("SELECT * FROM mytable")
like image 31
cschulte22 Avatar answered Nov 15 '22 07:11

cschulte22