Terastream

JRuby client to query data from the Teradata data warehouse. Used in your own programs as a gem or via the terasql cli. The client takes a middleware based approach to formatting query results and streaming data to an output location.

Bundled formatter and output middlewares support formatting results as

  • Ruby objects
  • JSON records
  • lines of CSV

and streaming results to

  • STDOUT
  • Kafka
  • Redis pub/sub

Installation

  • install JRuby (9.0.0.0 preferred)
  • Check out the repo
  • rake install
  • ????
  • profit

If it's been pushed to a gem server:

Add this line to your application's Gemfile:

gem 'terastream'

And then execute:

$ bundle

Or install it yourself as:

$ gem install terastream

Usage

If using Terastream in your own application:

client = Terastream.new do |connection|
  connection.username  = "something"
  connection.password  = "password"
  connection.hostname  = "somehost.somwhere"
  connection.formatter = Terastream::JsonBuilder
  connection.output    = Terastream::Output::Redis
end

results = client.query("SELECT * FROM sometable")
results.each do |result|
  p result.field
end

Or using the terasql command line utility

terasql --username username --password password --host somehost.somewhere --formatter json --output redis --query "SELECT * FROM sometable"

Todo

  • Support for Amazon Kinesis as a results destination
  • Support for DDL files being run before final query execution

Warning

ALPHA SOFTWARE!!!!!

Contributing

  1. Fork it ( https://github.com/[my-github-username]/terastream/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request