DataSource with Postgres + Prisma (any benefits?)

Hello!

I’m working on employment an Apollo Server that uses Prisma to query a Postgres database.
Being that Prisma is supposed to help with the N+1 problem in most cases (at least that’s what current understanding is), would there be any benefit to create a customer DataSource for my resolver functions with Prisma? (would it automatically add things like caching for me?)

Thanks a ton!

I’ve had a lot of luck with this approach. I use dataloader with Apollo datasources to query MongoDB via Mongoose…more or less the same idea that you are asking about. I created a base Mongoose datasource that was able to encapsulate a lot of common functionality (e.g., crud, specifically the dataloader integration point), but could be extended in subclasses to enshrine collection-specific logic. By doing this, I noticed a considerable lessening of redundant queries via the magic of dataloader, and I assume Prisma would bring the same benefit. Good luck!