SQL to Databox with Databox Ruby Gem
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
db
.gitignore
.ruby-gemset
.ruby-version
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
boot.rb
databox_demo.gif
price.rb
prices.json
streamer.rb
tasks.rake

README.md

SQL → Databox with Databox Ruby Gem

How to quickly stream data from PostgreSQL to Databox with Databox Ruby Gem?

databox_demo.gif

Example

This example contains example on how to create PostgreSQL database that will hold OPEC oil prices. When new price is inserted into prices table PostgreSQL triggers NOTIFY and streamer.rb LISTENs and sends data to Databox.

Steps to get you going...

First create new .env in current project folder with your DATABOX_PUSH_TOKEN.

Create new database, start PostgreSQL daemon and setup new database:

initdb db/pg-data -E utf8;
postgres -D db/pg-data
rake db:setup

Start streamer that will LISTEN to inserts and push KPIs to Databox.

./streamer.rb

Open another terminal / session and run following task that will import couple of prices.

rake prices:import

For playing with data you can load IRB session:

irb -r./boot.rb
Price.create date:DateTime.now, volume:100
Price.import Price.all_from_ws

Author