Does anyone know of a way that we can use one data...
# orm-help
e
Does anyone know of a way that we can use one database URL for reads and one URL for writes so that writes are spread across the cluster as opposed to all going to the write endpoint generated by the RDS cluster?
a
Hey Elijah 👋 , You can dynamically pass a connection string when instantiating a
PrismaClient
so you could theoretically have two clients in your app, one for reads and one for writes.
Copy code
const readClient = new PrismaClient({
  datasources: { db: {url: "read connection string" }}
})

const writeClient = new PrismaClient({
  datasources: { db: {url: "write connection string" }}
})