data-api-client icon indicating copy to clipboard operation
data-api-client copied to clipboard

batch insert gives error

Open rabiSharelookapp opened this issue 4 years ago • 10 comments

while query is done for batchInsert it insert the multiple row but throws an error "BadRequestException:Batch entry 1 was aborted: Too many update results were returned. Call getNextException to see othe errors in the batch". though the items passed as same structure as in document . Here 1 is number of entry Screenshot from 2021-04-01 11-16-36

rabiSharelookapp avatar Apr 01 '21 05:04 rabiSharelookapp

This looks like a Postgres error. Are you able to run a smaller batch?

jeremydaly avatar Apr 01 '21 19:04 jeremydaly

I could run a small batch with 3 or might be more but it does insertion on table but throws that error even batch with length 1 .

On Fri, Apr 2, 2021 at 12:55 AM Jeremy Daly @.***> wrote:

This looks like a Postgres error. Are you able to run a smaller batch?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jeremydaly/data-api-client/issues/86#issuecomment-812113417, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS762I2CRSUCR4YSCV6Z6RDTGTAIZANCNFSM42GLEZ3A .

rabiSharelookapp avatar Apr 02 '21 04:04 rabiSharelookapp

what would be the solution for this @jeremydaly

rabiSharelookapp avatar Apr 02 '21 17:04 rabiSharelookapp

@ffxsam Any thoughts on this? Haven't seen this error with batches before.

jeremydaly avatar Apr 02 '21 17:04 jeremydaly

@jeremydaly today I got another situation that if table not exist then batch insertion execution is only done for 1 batch more than one it gives error but after 1 batch entry or table exist then more than 1 batch be inserted.Is this from my side or the issue (I have used create table if not exist query to create table and followed by insert script)

rabiSharelookapp avatar Apr 03 '21 16:04 rabiSharelookapp

No, sorry I can't be of any help. I actually don't use batch inserts very often. Plus, I'm using knex to build all my queries before passing the resulting string to dataApi.query().

ffxsam avatar Apr 03 '21 23:04 ffxsam

@Sam , could you suggest a library for knex that is compatible with data-api. I tried to do with knex.js only but couldn't connect using aws arn

On Sun, Apr 4, 2021 at 5:24 AM Sam Hulick @.***> wrote:

No, sorry I can't be of any help. I actually don't use batch inserts very often. Plus, I'm using knex to build all my queries before passing the resulting string to dataApi.query().

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jeremydaly/data-api-client/issues/86#issuecomment-812941393, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS762IZ4O5FFPFWWUGCD4J3TG6RKFANCNFSM42GLEZ3A .

rabiSharelookapp avatar Jun 07 '21 07:06 rabiSharelookapp

And also use case here is that need to perform migration , could you please suggest how to I perform that trough data-api-client

On Mon, Jun 7, 2021 at 1:29 PM Rabi Gautam @.***> wrote:

@Sam , could you suggest a library for knex that is compatible with data-api. I tried to do with knex.js only but couldn't connect using aws arn

On Sun, Apr 4, 2021 at 5:24 AM Sam Hulick @.***> wrote:

No, sorry I can't be of any help. I actually don't use batch inserts very often. Plus, I'm using knex to build all my queries before passing the resulting string to dataApi.query().

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jeremydaly/data-api-client/issues/86#issuecomment-812941393, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS762IZ4O5FFPFWWUGCD4J3TG6RKFANCNFSM42GLEZ3A .

rabiSharelookapp avatar Jun 07 '21 07:06 rabiSharelookapp

@rabiSharelookapp knex works fine with dataApi. You can use it like this:

const knex = require('knex')({ client: 'pg' });

async function doTheThing() {
  const results = await dataApi.query(knex('my_table').select('a', 'b', 'c'));
}

As for your other question, that's a bit of a general and very involved question that I unfortunately don't have time to help with.

ffxsam avatar Jun 07 '21 15:06 ffxsam

okay thanks

On Mon, Jun 7, 2021 at 9:07 PM Sam Hulick @.***> wrote:

@rabiSharelookapp https://github.com/rabiSharelookapp knex works fine with dataApi. You can use it like this:

const knex = require('knex')({ client: 'pg' }); async function doTheThing() { const results = await dataApi.query(knex('my_table').select('a', 'b', 'c'));}

As for your other question, that's a bit of a general and very involved question that I unfortunately don't have time to help with.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jeremydaly/data-api-client/issues/86#issuecomment-856030010, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS762I3BWQH5E4NXM4VIMW3TRTP3HANCNFSM42GLEZ3A .

rabiSharelookapp avatar Jun 09 '21 08:06 rabiSharelookapp