cx_Oracle没有正确读取LOB

时间:2015-06-29 04:19:21

标签: python oracle gis cx-oracle

我正在尝试使用cx_Oracle读取Oracle 12c数据库中的LOB字段。 (具体来说,这是一个ST_Geometry字段我正在获取well-known text。)我遇到的问题是,如果返回的值足够长,则光标将会切断一些初始数据在阅读过程中。例如,如果我运行以下SQL

SELECT SDE.ST_AsText(shape) FROM street_centerline where seg_id = 960897

在像SQL Developer这样的数据库客户端中我得到:

LINESTRING ( 2720095.00001681 281993.71874480, 2720084.25003831 281969.81262463, [...])

这就是我所期待的。但是如果我使用cx_Oracle

import cx_Oracle

db = cx_Oracle.connect('...')
c = db.cursor()
shape = c.execute('SELECT SDE.ST_AsText(shape) FROM street_centerline where seg_id = 960897').fetchone()[0]
print(shape.read())

我明白了:

( 2720095.00001681 281993.71874480, 2720084.250038 [...])

缺少几何类型。这似乎只发生在LINESTRING具有异常高的顶点数且LOB非常长时。谁能想到为什么会这样?

0 个答案:

没有答案