dimanche 26 avril 2015

How to load data to Dynamo DB Table with Global and Local Secondary Indexes ??

I have created some tables in Dynamo DB using AWS console and defined some global and secondary indexes.

Now the problem is how to load data in those tables using AWS SDK of java. I went through the Developer guide (http://ift.tt/1hPsXcr) of Dynamo DB but I could not find how to load data when your table has global secondary indexes.

Code to load table with data is :

  Table table = dynamoDB.getTable(tableName);
  Item item = new Item().withPrimaryKey("Name", "Amazon DynamoDB")
                        .withString("Category", "Amazon Web Services")
                        .withNumber("Threads", 2)
                        .withNumber("Messages", 4)
                        .withNumber("Views", 1000);
  table.putItem(item);

Now suppose in my table if I have defined Views as Global Secondar Index. So the same code will work or there are some different method to deal with this kind of use cases ??




Aucun commentaire:

Enregistrer un commentaire