Giter Club home page Giter Club logo

td-querier's Introduction

Treasure Data and Sidekiq awesomeness

###Concept Treasure data jobs take sometime to finish, and in most scenarios waiting is not really an option. Td-querier will create a Sidekiq job with the job_id of your Treasure Data Queries and will check if the job has finished. If it is finished, it will send a callback to continue your data process. If not it will reschedule itself until the job is done.

###Installation $ gem install td-querier

###Usage

querier = Querier.new("TREASURE_DATA_API_KEY")
database_name = 'my_td_database_name'
query_text = 'select count(*) from my_table'
options = {:klass=>"MyClass", :method=>"my_method", :results => "true"} #See Options section for this one

#Optional
on_demand_path = 'mysql://user:password@host/database/table' #will insert the result of your query into another table
priority = 1 #default 1
reschedule_time #Time interval for checking if the job is finished

querier.query(database_name, query_text, on_demand_path, options, priority, reschedule_time)

###Options Once the job has finished sidekiq will stop retriying and will send a callback to a class method specified on the options.

  • klass: The name of the class you want to use, i.e. "MyClass"
  • method: The name of the class method you want to use, i.e. "my_method"
  • results: if is "true" will fetch the results from treasure data and it will pass those results to your method as a parameter. Be aware that exceptionally large results might impact your performance.

###Internals Querier objects are designed to query treasure data api asynchronously. This gem uses [Sidekiq] (https://github.com/mperham/sidekiq) so make sure your app plays nice with that. Also it uses td gem

td-querier's People

Contributors

cads avatar

Watchers

Oskar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.