FlyData Heroku Gem

With FlyData, you can import your log data directly into your Amazon Redshift cluster tables. Your application outputs data in JSON format in the application log, which FlyData then picks up and imports automatically to a corresponding table in your Redshift Cluster.

This gem allows you to generate FlyData JSON from various Ruby object types and output to your Heroku application log.

Examples

Send a record created from a hash to RedShift

require 'flydata'

FlyData.send_to('user_activities', {:user_id => 293298, :action => 'signin' })

This outputs a JSON string in your app’s application log, which FlyData will pick up and import to the user_activities tables in your Redshift cluster

Send records from an array to Redshift

activity_log = [ {:user_id => 293298, :action => 'signin' },
               {:user_id => 293298, :action => 'purchase', :item_id => 83 },
               {:user_id => 382990, :action => 'signup' }
    ]

FlyData.send_to('user_activities', activity_log)

This outputs 3 lines of JSON string in your app’s application log, which eventually get imported to user_activities table in your Redshift cluster.

Send a record from an ActiveRecord object to Redshift

user = User.find(293298)
user.send_to_flydata

This outputs a JSON string with values from the user object. FlyData imports the data into the users table in your Redshift cluster.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk