3 ms·
I don't even want an abstraction for building SQL unless I need to build queries dynamically from some other (presumably simpler) query language. Put all the S
by cryptonector 8y ago
I don't even want an abstraction for building SQL unless I need to build queries dynamically from some other (presumably simpler) query language.
Put all the SQL in .sql files and make all queries parametrized. Or wrap all queries in VIEWs or functions at the RDBMS. This makes maintenance much easier.
- dragonwriter 8y ago> Or wrap all queries in VIEWs or functions at the RDBMS. This is like the oldest best practice for RDBMS use, for security, and for decoupling consuming apps from each other and the DBs low level implementation (so that app views and base tables can evolve independently to the extent possible), and for maintainability: all app access to the DB should be through views adapted to the apps needs.
- cryptonector 8y agoExactly. And it works very well. I recommend PostgREST to export a RESTful interface to a single PG schema's VIEWs and functions, and RLS and INSTEAD OF triggers as needed.