3 ms·
>With a low level abstraction layer, I can do stuff like already_complicated_query.filter(another_param==5). Or I can write a function that does get_world_trade
by akavi 12y ago
>With a low level abstraction layer, I can do stuff like already_complicated_query.filter(another_param==5). Or I can write a function that does get_world_trade_aggregate(country="USA", aggregate="average") and it'll generate the right query for me. But then that's not even all, if I have to modify or filter that query further in some other part of the code, in some unexpected way totally doable. It's less often that I have to write a whole new function or duplicate code.
If you're working in Ruby, there's also Arel[1]. I have my complaints, but it seems to be the exact same thing: Composable, programmatic access to SQL from your application code.
[1] https://github.com/rails/arel https://github.com/rails/arel
- jeltz 12y agoIf you are working with Ruby Sequel is a way better tool for building SQL queries. http://sequel.jeremyevans.net/ http://sequel.jeremyevans.net/