Dynamic read replicas

I have a use case that read replicas are dynamically located using Service Discovery and I need to store the underlying Client so that I can access it. Is there a way to access the underlying client from drizzle? From what I can see you can't, that's why I need to store the underlying replicas client on some variable. I could create an array of postgres-js client then map it like x.map(c => drizzle(c, { schema})) then pass this mapped array to withReplicas, but got myself a TypeError from typescript. REF: https://orm.drizzle.team/docs/read-replicas
Drizzle ORM - Read Replicas
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
No description
4 Replies
hzmi
hzmi2mo ago
The error ^
hzmi
hzmi2mo ago
Example code:
No description
hzmi
hzmi2mo ago
Current solution:
No description
hzmi
hzmi2mo ago
Is this intended or a bug from withReplicas typescript types?