3 ms·
Did you know it’s impossible to set a statement timeout for your DB connections in prisma? There’s no hook to run commands when a connection in a pool is establ
by mplanchard 2y ago
Did you know it’s impossible to set a statement timeout for your DB connections in prisma? There’s no hook to run commands when a connection in a pool is established, and there’s no exposed setting for it. The only way to manage it is either to set it at the user level or to set up whatever they call a middleware layer (client extension?) that issues the command to set the timeout before every single query
An engine that doesn’t allow you to set per-connection settings effectively is pretty crazy IMO.
- foreigner 2y agoIt's possible now with the built-in "db adapter" plugin. I also have lots of misgivings about the Prisma ORM, but this particular thing is possible now.
- mplanchard 2y agoCan’t find any docs on this, could you point me to what you’re referencing?
- foreigner 2y agoConfigure Prisma with https://www.prisma.io/docs/orm/overview/databases/postgresql#using-the-node-postgres-driver https://www.prisma.io/docs/orm/overview/databases/postgresql... Then you can pass `statement_timeout` when you create the `pg.Pool`
- mplanchard 2y agoOh I see, thanks! So you just need to opt out of their drivers entirely and configure with the alternative package’s driver.