Comment by doubleg
1 month ago
I'm working on AppQuery, a Ruby gem that makes raw SQL for Rails more intuitive https://rubygems.org/gems/appquery.
You put queries in a file `app/queries/foo.sql.erb`. Casting works and can be customised. There's ERB-support for parameterisation, with helpers like order_by and paginate.
The gem can parse and rewrite CTEs which allows for 1) rewriting the query such that basic queries (first, take, count etc.) are performant (Rails does `resultset.count`). And 2) given your query contains CTEs, it allows to write tests per CTE.
No comments yet
Contribute on Hacker News ↗