aws-sdk-go-v2
aws-sdk-go-v2 copied to clipboard
rds data api- need way to get all exceptions from BatchExecuteStatement
Describe the feature
When using BatchExecuteStatement using rdsdata api, a single error from the batch is returned in the error object, with the message stating:
. Call getNextException to see other errors in the batch.
There seems to be no way to actually call getNextException or access the rest of the errors in the batch. This is a huge issue for me since it makes it impossible to know which statements of the batch has failed/succeeded.
Use Case
This is needed whenever there is a need to know which statements of a batch has failed or succeeded, which I would say is almost always. In my case I want to retry statements that failed later, but without knowing what has succeeded or failed I have to roll back and retry the entire batch which is very inefficient.
Proposed Solution
I would prefer not having to call a function to get the next exception if possible, I think the best solution would be to have a custom error type that can be casted to which contains an array of the sub errors in the batch. It would also be nice if the sub errors were typed (fk contraint error etc) and the parameters of the statement that failed (from the parameterSets input).
However, the most important thing is a way to retrieve all the errors.
Other Information
No response
Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
AWS Go SDK version used
V2 @latest
Go version used
1.18
Can you help us understand this feature request more by providing the HTTP Response Body that you had when using BatchExecuteStatement using RDS Data API?
This issue has not received a response in 1 week. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.
@vudh1 I'm not sure what you mean, I use this SDK to interact with the API and the client provided does not expose the http body itself (unless im missing something?).
@karlc1 can you follow the guide for Logging in the SDK and enable the aws.LogResponseWithBody log mode option? We just want to validate whether there is content over the wire that is just missing from the service's model, or if this is a feature request that needs to be directed towards the service team.
@skmcgrail @vudh1
I see, thanks for the clarification. It seems like this is an issue with the service and not the SDK, the http response does not include anything useful in terms of providing the rest of the errors of the batch.
Note that I just did some invalid query here with a batch of 2 entries that both should fail, so see if there is any info on the second entrys error:
SDK 2022/04/27 11:36:27 DEBUG Response
HTTP/1.1 400 Bad Request
Connection: close
Content-Length: 297
Content-Type: application/json
Date: Wed, 27 Apr 2022 09:36:27 GMT
X-Amzn-Errortype: BadRequestException:http://internal.amazon.com/coral/com.amazon.rdsdataservice/
X-Amzn-Requestid: 09674302-2501-4750-8558-47eb422170d6
{"message":"Batch entry 0 \nINSERT INTO device(id\n )\n\t\t\t\t VALUES ('some-id', 'some-site-id', 'test')\nRETURNING * was aborted: ERROR: INSERT has more expressions than target columns\n Position: 62 Call getNextException to see other errors in the batch.; SQLState: 42601"}
After googling a little it seems to me like the getNextException mentioned in the error message is a function in some postgres java driver, so my guess is that the service itself written in java and is is just propagating the java error in the http response body. I guess the solution here would be for the data service to call that func to collect all errors before returning the response.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.