They released TypedSql (https://www.prisma.io/docs/orm/prisma-client/using-raw-sql/t...) which is heavily inspired by PgTyped. That lets me write raw Postgres SQL that's converted into TypeScript. The other things I do:
- If I want derived data, write views that encapsulate the transform. Prisma supports reading from views - If I need something more complex, use DuckDB + python for analysis and write to the appropriate table. - If I need to cache complex queries, just use a materialized view and read it as a prisma object
It's not perfect, but that let's me use prisma for what it's good at (Managing an ORM and deeply nested queries), then fall back into raw SQL for everything else.
Going straight to SQL has been a breath of fresh air, but, let's be honest, dealing with deeply nested joins really sucks when all you want to do is build a page that shows a company, all of it's people, and all of those people's relationships. ORMs are pretty handy for that last case, and I use SQL for everything else