2

I am doing a bulk operation for insertion and suddenly started getting this following error . what I am doing wrong ? query consist of 50 rows of data . How I can fix this ?

  botocore.errorfactory.BadRequestException: An error occurred (BadRequestException) when calling the ExecuteStatement operation: Number of characters in SQLStatement is longer than 65536
TNN
  • 391
  • 1
  • 5
  • 12
  • Please add the relevant lines of code – OARP Jan 12 '22 at 16:56
  • Its like bulk insertion query @OmarRosadio . are you asking for query ? – TNN Jan 12 '22 at 16:59
  • Seems like this is a hard limit. The limit is on characters it seems. How many characters do you have in the query?https://docs.aws.amazon.com/rdsdataservice/latest/APIReference/API_ExecuteSql.html – Riz Jan 12 '22 at 17:13
  • @FawadRana - The generic approach would be to insert fewer rows at once. How you would go about that depends on (a) what your input looks like and (b) what your (Python?) code looks like. If you want help beyond generic statements, you'll want to include those things. – Erwin Jul 03 '22 at 20:13

1 Answers1

0

Probably if you do a rough estimation you will find out that the number of characters of the SQL Statement exceeds the mentioned count of characters: 65536

So one simple solution can be to split those insertions in separate SQL statements.

I assume you are using AWS RDS service, and they explicitly mention that limit: https://docs.aws.amazon.com/rdsdataservice/latest/APIReference/API_ExecuteSql.html

Cesar Augusto Garcia
  • 1,476
  • 1
  • 6
  • 4