Re: Question about where to deploy the business logics for data processing
От | Michael Nolan |
---|---|
Тема | Re: Question about where to deploy the business logics for data processing |
Дата | |
Msg-id | CAOzAquJFMSHhtKUuAZfB6-xZ9dO3EE+0Fy0oB3tDq+LUtJoeug@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Question about where to deploy the business logics for data processing (Rob Sargent <robjsargent@gmail.com>) |
Список | pgsql-general |
Clearly I'm a 73 year old dinosaur, because I believe in having the business logic in the database wherever possible. But the development projects I've been around lately aren't using triggers at all. (And it should not surprise anyone, certainly not me, that consistency of data enforcement is an ongoing issue in these projects.) Mike Nolan On Fri, Jun 9, 2023 at 10:06 AM Rob Sargent <robjsargent@gmail.com> wrote: > > > > > On Jun 8, 2023, at 8:21 PM, Nim Li <mr.nim.li@gmail.com> wrote: > > > > Hello. > > > > We have a PostgreSQL database with many tables, as well as foreign table, dblink, triggers, functions, indexes, etc,for managing the business logics of the data within the database. We also have a custom table for the purpose of trackingthe slowly changing dimensions (type 2). > > > > Currently we are looking into using TypeORM (from Nest JS framework) to connect to the database for creating a BE thatprovides web service. Some reasons of using TypeORM are that it can update the database schema without any SQL codes,works very well with Git, etc. And from what I am reading, Git seems to work better with TypeORM, rather than handlingindividual batch files with SQL codes (I still need to find out more about this) Yet I do not think the ORM conceptdeals with database specify functions, such as dblink and/or trigger-function, etc, which handles the business logicsor any ETL automation within the database itself (I should read more about this as well.) > > > > Anyway, in our team discussion, I was told that in modern programming concept, the world is moving away from deployingprogramming logics within the database (eg, by using PL/SQL). Instead, the proper way should be to deploy all theprogramming logics to the framework which is used to connect to the database, such as NestJS in our case. So, all weneed in a database should be only the schema (managed by ORM), and we should move all the existing business logics (currentlymanaged by things like the database triggers, functions, dblink, etc.) to the Typescript codes within the NestJSframework. > > > > I wonder if anyone in the community has gone through changes like this? I mean ... moving the business logics from PL/SQLwithin the database to the codes in NestJS framework, and reply on only the TypeORM to manage the update of the databasewithout any SQL codes? Any thoughts about such a change? > > > > Thank you!! > > > > You’re riding a pendulum which has swung too far. > In any organization of even minimal complexity, the physical data model and the deployable business model are never wellaligned: the usages of the data are in a different dimension than the storage and maintenance of the data. I’ve notheard of TypeORM but on this list ORMs are notorious for generating poorly performing queries. The notion that applicationprogramming will replace database triggers is ludicrous. > > >
В списке pgsql-general по дате отправления: