LOB not being read correctly

Issue #20 closed
Robert Martin
created an issue

Hello!

I am trying to read a LOB object returned by a spatial function in an Oracle 12c database. In general this works fine, but I've noticed that if the size of the LOB exceeds ~9963 bytes the cursor will omit everything up to the first left parenthesis. So essentially what I'm expecting is:

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

and what I'm getting back is:

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

No matter how big the LOB, it always starts right there at the (. I don't see anything else wrong with the output. It doesn't appear to be truncated at the end.

I tried the same query in a database client (SQL Developer) and couldn't reproduce the issue.

For reference this is my SQL:

SELECT SDE.ST_AsText(SHAPE) FROM STREET_CENTERLINES WHERE SEG_ID = 960897

And Python:

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())

Any insights would be much appreciated!

Thank you.

Comments (4)

  1. avnandak

    I have tried to reproduce the problem with my own sample clob data. However I am not able to see the problem. Can you give schema and data to reproduce the problem? For example:- create table street_centerline(...) insert into table (...)

  2. Log in to comment