I have a column in postgres DB of data type bytea and encoding is of compressed_json. How can I read the values of this column and get a proper json back in Python?
But the method gzip.compress and decompress is not showing. Maybe its a version issue with my gzip module. Anyways, I was able to decompress using below way :
Convert and store the column as byte array :-
payload = bytearray(row[0])
For decompressing, used below code snippet :
fileobj = cStringIO.StringIO(payload)
gzf = gzip.GzipFile('dummy-name', 'rb', 9, fileobj)
decomprJson = gzf.read()