While I'm very curious to hear how
While I'm very curious to hear how others have tackled this, I will say that RLS is not a great UX for Hyperdrive. There's a lot of impedance mismatch between the sleight-of-hand Hyperdrive uses to achieve its performance and session-level state like RLS.
The least-bad version here is probably to use something like
SET ROLE myrole; SELECT my_actual_query;. This will disable caching, but Hyperdrive will RESET ALL; after returning the connection to the pool and it'll get you what you're going for without extra locks or round trips.
We're still kicking around ideas for how to improve DX here in a way that's more practical.2 Replies
To confirm, the suggestion is the same is this, correct?
https://orm.drizzle.team/docs/rls#:~:text=Please%20check%20Drizzle,from%20this%20repository
Drizzle ORM - Row-Level Security (RLS)
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
No, that still looks like it's using an explicit transaction, instead of just a multi-statement query within a single implicit transaction.
Same basic idea, though, just less performant.