Closed ffxsam closed 4 years ago
@ffxsam, the data type mappings are for MySQL. This should be fixable by adding the correct data type and mapping it in getType()
. Can you send an example of the raw Data API response?
@jeremydaly Sorry for the delay, just now circling back on this.
What do you mean adding the correct data type and using getType()
?
Here's the raw response from dataApi.query
:
{
records: [
{
id: 1,
file_uuid: 'affaa9ad-a968-452f-9f72-f3914d2c3782',
name: 'Test File',
owner_id: 'cbf0cd89-7788-457c-8c32-3e725cd5d26b',
duration: '233.578',
metadata: '{"name": "Test 123", "year": 2020}',
filesize: 827312,
original_filename: 'Nothing.wav',
folder_id: null,
transcode_status: 'PENDING',
internal_notes: null,
public_notes: null,
deleted: false,
created_at: '2020-08-28 16:08:27.988319',
updated_at: '2020-08-28 16:08:27.988319',
}
]
}
This looks like the marshalled response from the library. The "raw" response should look something like this:
[
{ "longValue": 9 },
{ "stringValue": "Cousin Oliver" },
{ "longValue": 10 },
{ "booleanValue": false }
]
There is a getType()
function in the source that needs to know the "data type" in order to coerce it to the correct JavaScript data type.
Oh, you meant the raw response from RDSDataService.
{
"stringValue": "233.578"
},
Aha! So RDSDataService
is lying to you. 😄 I'll report this to AWS, seems like a bug. Now the question is, is it an issue with the core API, or just the JS SDK? (edit: looks like there's an open issue already - https://github.com/aws/aws-sdk-js/issues/3114)
At any rate, feel free to close this issue. Thanks, Jeremy!
Expected behavior, evidently: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html#data-api.calling
Very odd to me that they treat DECIMAL
as a string. 🤔 But not likely to change, as it would be a breaking change I think.
In my table, I have a column "duration" of type
numeric(7,3)
. The Data API client is returning this as a string: