Is there any way dynamodb can handle dynamic attributes? Depending on the request, I need to store different web query parameters in the same table.

What I want to do is like this, if I make a java hashmap with query parameter's key and value, and just put them into dynamodb, then the dynamodb automatically uses hashmap's key for attribute's name and hashmap's value for attribute's value.

Actually I'm using Scala for server side and I know that Scanamo library can do this in easy way by making case classes for every case but it's quite inefficient for me because I have to make every case class for every combination of parameters and I don't event predict what kind of parameters would come.

Is there any way to do this in scanamo or dynamodb except for using insert JSON format?

val paramsMap = params.iterator.toMap
val item: Item = new Item()
  .withPrimaryKey(Partition_Key_Name, partition_key)
  .withKeyComponent(Sort_Key_Name, sort_key)

paramsMap.map { case (k, v) => item.withString(k, v) }

can be solved like this in scala

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.