Add upsert tests
Retry if upsert returns error
Fix upsert query
Merge pull request #100 from flyvictor/retry-upsert-failures

Retry upsert failures