Invoking a large set of SQL from a Rails 4 application -
i have rails 4 application utilize in conjunction sidekiq run asynchronous jobs. 1 of jobs run outside of rails application big set of complex sql queries cannot modeled activerecord. connection set of sql queries has rails app should executed anytime 1 of controller actions invoked.
ideally, i'd queue job rails application within controller sidekiq go ahead , run queries. right they're stored in external file, , i'm not exclusively sure best way have rails run said sql.
any solutions appreciated.
i agree sharagoz, if need run specific query, best way send query string straight connection, like:
activerecord::base.connection.execute(file.read("myquery.sql")) if query not static , have compose it, utilize arel, it's nowadays in rails 4.x:
https://github.com/rails/arel sql ruby-on-rails ruby ruby-on-rails-4 sidekiq
No comments:
Post a Comment