valueInserted = zlib.compress('a') = 'x\x9cK\x04\x00\x00b\x00b'
Note that this is an str object. You say that you "inserted it into a mysql column that is of type blob, using the utf-8 encoding". AS the compressed string is binary, not text, "blob" is an appropriate type of column, but ANY encoding or other transformation is a very bad idea. You need to be able to recover from the database EXACTLY right down to the last bit what you inserted, otherwise the decompression will fail, either by raising an error or (less likely, but worse) silently producing garbage.
You say that you get back after whatever process you go through in inserting it and extracting it again is:
valueFromSqlColumn = u'x\x9cK\x04\x00\x00b\x00b'
Note carefully that there is only one tiny visual difference: u'something' instead of 'something'. That makes it a unicode object. Based on your own evidence so far, "comes back as UTF-8" is not correct. A unicode object and a str object encoded in utf8 are not the same thing.
Guess 1: insert as raw string, extract with latin1 decode.
Guess 2: insert as compressed.decode('latin1').encode('utf8'), extract with utf8 decode.
You really need to understand the process of inserting and extracting, including what encodes and decodes happen by default.
Then you really need to fix your code. However in the meantime you can probably kludge up what you've got.
Note this:
>>> valueFromSqlColumn = u'x\x9cK\x04\x00\x00b\x00b'
>>> all(ord(char) <= 255 for char in valueFromSqlColumn)
True
Do some trials with more complicated input than 'a'. If, as I guess, you see that all of the unicode characters have an ordinal in range(256), then you have a simple kludge:
>>> compressed = valueFromSqlColumn.encode('latin1')
>>> compressed
'x\x9cK\x04\x00\x00b\x00b'
>>> zlib.decompress(compressed)
'a'
Why this works is that Latin1 encoding/decoding doesn't change the ordinal. You could recover the original compressed value by:
>>> compressed2 = ''.join(chr(ord(uc)) for uc in valueFromSqlColumn)
>>> compressed2
'x\x9cK\x04\x00\x00b\x00b'
>>> compressed2 == compressed
True
if you think using .encode('latin1') is too much like voodoo.
If the above doesn't work (i.e. some ordinals are not in range(256)), then you will need to produce a small runnable script that shows exactly and reproducibly how you are compressing, inserting into the database, and retrieving from the database ... sprinkle lots of print "variable", repr(variable)
around your code so that you can see what is happening.