3 ms·
These projects look great for reading data (although there are times where I would prefer to transform the data server side, that's not a deal breaker). However
by gregwebs 4y ago
These projects look great for reading data (although there are times where I would prefer to transform the data server side, that's not a deal breaker). However, they always seem lacking to me for writing data if I need to add business logic (I don't want to do this with triggers).
Then if I am going to write an API for writing data, just adding some for reading data doesn't seem like much effort, although I see the value proposition as frontend development getting a very consistent API without having to ask the backend to develop APIs.
- agentultra 4y agoYou can use a library like https://github.com/agentultra/postgresql-replicant https://github.com/agentultra/postgresql-replicant or similar to hook in a control plane and use PostgREST as a data plane. Your business logic works on the event stream that comes from the WAL.
- gregwebs 4y agoI want synchronous validation with business logic. After the synchronous validation event streaming could be useful.
- Twisell 4y agoYou should be able to implement business logic sever side with stored procedures in plain PL/pgSQL OR with various supported procedural languages depending on your need (included with base distribution or through extensions). Same for transformation server side, unless I'm wrong, you are not limited to ORM like construct. You can call a stored procedures and only the result of server side computation is sent back.
- dventimihasura 4y agoWhy don't you want to write triggers?
- majkinetor 4y agoThey are considered GOTO of db. Good luck debuging complex trigger hierarchy.
- dventimihasura 4y agoThey are considered that by whom? Not by me, they're not. Personally, I've never encountered a complex trigger hierarchy and I see no good reason why I ever would, and I write lots of triggers. But, that's just me. Your results may vary.
- majkinetor 4y agoExperts: https://www.red-gate.com/simple-talk/databases/sql-server/t-sql-programming-sql-server/triggers-threat-menace https://www.red-gate.com/simple-talk/databases/sql-server/t-...
- dventimihasura 4y ago"When I work with TRIGGERs, which is rare" Evidently, even some experts do use triggers. "I normally limit them to at most one per operation per TRIGGER" Great! So do I! So far so good. I guess I'm still in the good graces of some experts. "in full ANSI/ISO SQL, we do have schema level constraints, the CREATE ASSERTION statement, but that is another topic" Not in PostgreSQL, we don't. Evidently some experts may not be perfect experts.