Make sure keys always have type `str`.

The MySQL driver yields `bytearray` which is mutable, which means
it isn't hashable, which is surprising. (A fair bit of code assumes
content ids are hashable byte strings.)