我有一个带有 LONG RAW 列的旧数据库。此列中存储的数据约为 100KB。我正在尝试使用 cx_Oracle 访问这些二进制数据。
它正在工作,但是我可以提取的最大大小是~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
列的新表。但我买不起,因为我已经拥有这种格式的大量数据......
任何想法?