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

Support "formatRecordsAs" in ExecuteStatementRequest

Open finnwiz opened this issue 1 year ago • 4 comments

The AWS SDK for the Data API supports a "formatRecordsAs" parameter on the ExecuteStatementCommand object, with default value of "NONE" and possible value of "JSON".

See details at:

  • https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html and
  • https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html#data-api-json

If formatRecordsAs = 'JSON', then the result of ExecuteStatementCommand includes a single (JSON-formatted) string in ExecuteStatementResponse.formattedRecords.

It would be great to support this parameter in local development for ExecuteStatementCommand (via updating ExecuteStatementRequest and ExecuteStatementResponse).

But also this library is great :). Thank you.

finnwiz avatar Nov 06 '23 19:11 finnwiz

Hey @finnwiz, did you find a workaround for this?

cip123 avatar Jun 09 '24 14:06 cip123

More or less. Just returned ColumnMetadata and interrogated the col.typeName attribute as we looped over records (and columns) and decoded each result (including parsing columns of JSON type, for example). It's not perfect (and making the typing conventions robust across all use cases is probably horrible) but it worked for us.

finnwiz avatar Jun 09 '24 15:06 finnwiz

Thanks for the response. I created a PR because it seems like we will use this feature a lot. I hope it gets merged.

cip123 avatar Jun 09 '24 21:06 cip123

Would be so sick to get this merged in 💪

alextriaca avatar Jul 25 '24 15:07 alextriaca