Multiple uploads to glacier leave inconsistent sqlite db

I use git-annex as a frontend for glacier-cli. If I try to upload files multiple times to glacier the sqllite db is left in an inconsistent state (Multiple rows with the same name)

I wrote a really simple mechanism to handle the case when uploading a new archive by checking the existence of the name in the db.

But I'm not fluent in python and not 100% sure how to handle the inventory cache right.