我一直在尝试使用python从Oracle提取压缩的blob并将其解压缩。但是较大的Blob无法完全解压缩。
我尝试使用数据帧和文件存储blob,然后对其进行解压缩,但它不会转换较大的blob。记忆可能是问题吗?我可以尝试哪些更改?
我无法共享Blob作为其受限数据。而且我无权创建测试数据。
我正在使用以下来自git的解压缩代码进行解压缩,这对于较小的blob来说非常合适
https://github.com/joeatwork/python-lzw/blob/master/lzw/init.py
下面是我的示例代码:
sql_string = """select
event_id
,blob_length
,blob field
from table"""
cur.execute(sql_string)
path = "P:/Folders/"
for row in cur:
print('de-BLOBbing {}..\n')
filename = path + "clinical_notes_" + str(row[0]) + "_" + str(row[1]) + ".txt"
filename1 = path1 + "clinical_notes_" + str(row[0]) + "_" + str(row[1]) + ".txt"
f = open(filename, "wb")
f.write(row[3].read())
f.close()
h = html2text.HTML2Text()
h.ignore_links=True
blobbytes = row[3].read()
f2 = h.handle(striprtf(decompress_without_eoi(blobbytes)))
f1 = codecs.open(filename1, encoding='utf-8', mode='wb+')
f1.write(f2)
f1.close()