mercredi 14 octobre 2015

Rails aws dynamo insert into database

I use this code to insert into dynamo db:

require "aws"

AWS.config(
    access_key_id: 'xxxxxxxxxxxxxxxxxx',
    secret_access_key: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    region: 'eu-west-1'
)

dynamo_db = AWS::DynamoDB.new


table = dynamo_db.tables['mytable']
table.hash_key = [:string, :string]

# add an item
table.items.create(id: '12345', 'foo' => 'bar')

Everything is ok, the data is inserted but I still get this error:

missing hash key value in put_item response

What did I missed? According their documentation seems to be ok.




Aucun commentaire:

Enregistrer un commentaire