boto dynamodb batch_write and delete_item -- 'The provided key element does not match the schema'
Question: I'm trying to delete a large number of items in a DynamoDB table using boto
and python. My Table is set up with the primary key as a device ID (think MAC
address.) There are multiple entries in the table for each device ID, as the
secondary key is a UNIX timestamp.

From my reading this code should work:

    
    
    from boto.dynamodb2.table import Table
    
    def delete_batch(self, guid):    
        table = Table('Integers')
    
        with table.batch_write() as batch:
            batch.delete_item(Id=guid)
    

Source: <http://docs.pythonboto.org/en/latest/dynamodb2_tut.html#batch-
writing>

However it returns 'The provided key element does not match the schema' as the
error message.

I suspect the problem is because guid is not unique in my table.

Given that, is there way to delete multiple items with the same primary key
without specifying the secondary key?


Answer: You are providing only the hash part of the key and not an item (hash+range) -
this is why you get an error and can't delete items.

You can't ask DynamoDB to delete all items with a hash key (the same way Query
gets them all)

Read [this answer](http://stackoverflow.com/a/9159431/359134) by Steffen for
more information

