BigQuery
Google BigQuery API client library
Installation
Add this line to your application's Gemfile:
gem 'yancya-big_query'
And then execute:
$ bundle
Or install it yourself as:
$ gem install yancya-big_query
Usage
bq = Yancya::BigQuery.new(
key_path: "path_to_secret_key"
issuer: "mail@address"
)
job = bq.jobs.query(
project_id: "name_of_project",
sql: "select 1 as a, 2 as b, 3 as c"
)
begin
result = job.query_results
end until result["jobComplete"]
result["schema"]["fields"].map{|f| f["name"]}.join(",") #=> "a,b,c"
result["rows"].map{|row| row["f"].map{|col| col["v"]}.join(",")} #=> ["1,2,3"]
Google BigQuery API Reference
https://developers.google.com/bigquery/docs/reference/v2/
Contributing
- Fork it ( https://github.com/yancya/big_query/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request