Parameter Limit on Bulk Insert

Hey @awilly!

Using a little JavaScript can be really helpful for batching your data so that you can insert it in smaller chunks. Of particular usefulness is the ability to trigger a query with additional scope (docs). Using that along with the _.chunk function you can do something like:

const batchSize = 50;
const batchedData = _.chunk(fileButton.parsedValue[0], batchSize);
batchedData.forEach(batch => insertQuery.trigger({additionalScope: {batch}}));

Which triggers your insert query for each batch created by the _.chunk function, passing that batch to it as well. Meaning that, in your insert query, you can reference {{ batch }} It'll show up as undefined but that's because it's only defined at the moment the query is triggered in the script!

Does that work?

Otherwise, I'd be curious if you could share a screenshot of the error message you're getting from the query and we can investigate that further!

4 Likes