Why must batches be readonly?
Hi y'all!
I'm using
drizzle-orm
to insert a lot of rows. I want to avoid making too many trips to my database, so I've decided to batch some statements together. The trouble is, it appears that db.batch
requires the statements passed in to be within a read-only array, which means I cannot dynamically build the statements. Is there a specific reason why that is the case?
The underlying DB should be able to support dynamically-built arrays of statements.4 Replies
The only way to return a concrete type from DB.batch is if you give it a static query.
It can handle the dynamic queries but it won't be able to return the types back to you correctly, it will probably be a generic monstruosity
I don't care about the return values at all, other than if they are erroring maybe
Is there a way to disable that check, or do I need to cast it in?
Yeah if you don't care about the return type just cast it
Thanks!