2
我使用了LONG RAW列的遗留数据库。存储在这个列中的数据大约是〜100KB。 我试图用cx_Oracle访问这些二进制数据。使用cx_Oracle读取LONG RAW
它正在工作,但我可以提取的最大尺寸是〜41KB!
这里是我的代码(从http://dbaportal.eu/?q=node/147)
cursor = db.cursor()
cursor.arraysize = 1
cursor.setoutputsize(1200000000)
cursor.execute("select data from mytable")
print cursor.description
for row in cursor:
data = row[0]
f = open("/tmp/data",'wb')
f.write(data)
f.close()
# Only first line
break
输出是这样的:
$ python oracle.py
[('GRIB', <type 'cx_Oracle.LONG_BINARY'>, -1, 0, 0, 0, 1)]
$ ls -lh /tmp/data
41186 2011-01-20 12:42 /tmp/pygrib
我知道LONG RAW
不容易对付。有些方法告诉用BLOB
列重新创建一个新表。但我买不起,因为我已经有了这种格式的数据...
任何想法?
我好奇 - 为什么这个`cursor.setoutputsize(1200000000)`?我发现它在你的链接代码中是不同的。 – Tshepang 2011-01-21 14:35:57