You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it returns error
'_content' => '{"__type":"com.amazon.coral.service#SerializationException","Message":"class java.lang.Short can not be converted to an String"}',
but if I query with
get_item('test_picture', { id => $id, version => "1"})
Just to be clear:
Are you asking why I am "casting" every value in put_item() to string? Or why I don't do it in get_item()?
For the former: Amazon seems not to accept non-quoted numeric values, even if the type is "N" (and even though RFC 4627 does allow non-quoted numeric values). They throw the SerializationException, you've seen.
So: putting {"id": "1"} works, putting {"id": 1} fails (with the execption).
For the latter: This would be a bug, i will fix it - thanks for finding :)
For now, you can "stringify" your values beforehand yourself eg:
Hello.
is there any reason that you have
$value = $item_ref->{ $key } .'';
in line 720. the . '' seems quite weird for me when the key is N.
for example, I set table as
{"Table":{"CreationDateTime":1.350285647082E9,"ItemCount":0,"KeySchema":{"HashKeyElement":{"AttributeName":"id","AttributeType":"S"},"RangeKeyElement":{"AttributeName":"version","AttributeType":"N"}},"ProvisionedThroughput":{"ReadCapacityUnits":10,"WriteCapacityUnits":5},"TableName":"test_picture","TableSizeBytes":0,"TableStatus":"ACTIVE"}}
then put_item I set
{"Item":{"keywords":{"S":"Perl\nDynamoDB"},"filename":{"S":"1.jpg"},"date":{"N":"1350287320"},"version":{"N":"1"},"id":{"S":"MPCBvJwW4hGSd_kERh+kNg"},"tbuser":{"N":"999"}},"TableName":"test_picture"}
see, you have version converted into "1" here. actually I set version=1 in Perl.
and it will be broken for
get_item('test_picture', { id => $id, version => 1})
{"TableName":"test_picture","ConsistentRead":false,"Key":{"RangeKeyElement":{"N":1},"HashKeyElement":{"S":"MPCBvJwW4hGSd_kERh+kNg"}}}
it returns error
'_content' => '{"__type":"com.amazon.coral.service#SerializationException","Message":"class java.lang.Short can not be converted to an String"}',
but if I query with
get_item('test_picture', { id => $id, version => "1"})
it works:
{"TableName":"test_picture","ConsistentRead":false,"Key":{"RangeKeyElement":{"N":"1"},"HashKeyElement":{"S":"BO+oGaAW4hGmv4ycE82ppw"}}}
I just do not understand why we have . ''; when put_item?
any idea?
Thanks
The text was updated successfully, but these errors were encountered: