Activerecord::Bq::Adapter
Basic Implementation of an ActiveRecord Adapter for Google's Big Query. Just handles queries right now. See TODO list in the Readme for whats coming.
Installation
Add this line to your application's Gemfile:
gem 'activerecord-bq-adapter'
And then execute:
$ bundle
Or install it yourself as:
$ gem install activerecord-bq-adapter
Usage
Set your model to use the adapter. You probably won't want to do it for your entire app but rather just specific models like:
class MyModel < ActiveRecord::Base
set_table_name "<bq_dataset>.<bq_table>"
establish_connection(
:adapter => "bq",
:project_id => <project_id>,
:client_id => "<project_id>.apps.googleusercontent.com",
:client_secret => <client-secret>,
:refresh_token => <token>
)
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
TODO
- Asynchronous Queries, Inserts, Job handling
- Insert
- Bulk Inserts (from file, URL)
- Append vs Rewrite on insertion
- Specify table for results output
- Handle select * type queries (BigQuery requires explicit column names in select) - possibly use the Browsing Data part of the API
- Caching - perhaps using Faraday Middleware