Programmatic batch inserts
Akin to
npx convex import
, is there anyway (or any plans) to have the capability to do batch inserts that can be triggered by a client call (i.e. db.batchInsert(tableName, [...items])? The result would be a single item for each row in a table3 Replies
This might be an unimportant detail but it might be relevant:
db.insert(tablename, item)
can't be called on the client; it must run on a Convex server.
So you can write a helper much like this yourself,
Since Convex functions run on the server, this all happens in a single round-trip from client to server to client.
@Ewok does that make sense, am I getting at what you're asking?Ah yes, thanks for clarifying my question @ballingt 🙂 I guess my real question is will each db.insert(table, item) call in the loop be counted as a function call against my quota or will the entire batch be counted as one?
Ah gotcha, this is just one function call.