Handle more cases of DB deadlock with retries

When DB deadlock occurs, different SqlAlchemy exceptions could
be thrown.  Handle all of them by matching on the base exception
class.  Note that this is just a temporary hack to get around
this issue until a proper fix is in place.

Change-Id: If382ae4410ecdadce9ededf21690212853cb37c3
Fixes: MNP-13
Merge "Handle more cases of DB deadlock with retries" into stable/juno