3

I know that AmazonDB supports number, string, number set and string set as item types. But, how about a set of an string set (array of array, or multidimensional array)?

In case it's possible, this is the only way I found to do that, which didn't work (using PHP):

$units_frequencies["id"][0] = "400";
$units_frequencies["id"][1] = "401";
$units_frequencies["id"][2] = "402";
$units_frequencies["frequency"][0] = "20";
$units_frequencies["frequency"][1] = "30";
$units_frequencies["frequency"][2] = "50";

// item that will be inserted
$item = array(
    'id' => array(AmazonDynamoDB::TYPE_STRING => $id), 
    'arrays_field' => array(
        AmazonDynamoDB::TYPE_ARRAY_OF_STRINGS => array(
            AmazonDynamoDB::TYPE_ARRAY_OF_STRINGS => $units_frequencies)));

I don't want to have two columns (one for $units_frequencies["id"] and $units_frequencies["frequency"]) because the second one can have two index with the same values, which is not allowed by Dynamo.

Thanks in advance.

1
  • 1
    Sorry, forgot to paste the error returned by DynamoDB (in case it helps): [body] => CFSimpleXML Object ( [__type] => com.amazon.coral.service#SerializationException [Message] => Start of structure or map found where not expected. ) Commented Mar 2, 2012 at 18:15

2 Answers 2

1

It doesn't.
At least while looking at AttributeValue.class (AWS Java SDK)
I also couldn't find any hint on the documentation site except for those dealing with int, string, set of string or set of int

Sign up to request clarification or add additional context in comments.

2 Comments

You're right. I got rid of my problem by using a set of strings, on which each one of the indexes have the ID and frequency like that: 400#20, 401#30 and 402#50.
Great! If you believe an answer is correct, please mark it as one.
0

You can eventually serialize your object. More info at https://java.awsblog.com/post/Tx1K7U34AOZBLJ2/Using-Custom-Marshallers-to-Store-Complex-Objects-in-Amazon-DynamoDB

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.