BritishGeologicalSurvey / etlhelper

ETL Helper is a Python ETL library to simplify data transfer into and out of databases.
https://britishgeologicalsurvey.github.io/etlhelper/
GNU Lesser General Public License v3.0
104 stars 25 forks source link

wk buffer merge failure #130

Closed sophie-taylor closed 1 year ago

sophie-taylor commented 2 years ago

When trying to load geometries from oracle with SDO_UTIL.TO_WKTGEOMETRY(shape) it errors with the following message:

ORA-13199: wk buffer merge failure ORA-06512: at "MDSYS.SDO_UTIL", line 729 ORA-06512: at "MDSYS.SDO_UTIL", line 768

sql = f"select objectid, SDO_UTIL.TO_WKTGEOMETRY(shape) geom from BGS_GEOM.GB_50K_BEDROCK_GEOM_VOL"
with ORACLEDB.connect('ORACLE_PASSWORD') as conn:
   conn.outputtypehandler = output_type_handler
   for row in iter_rows(sql, conn):
        pass

I've managed to bypass this problem for now by using SDO_UTIL.TO_GMLGEOMETRY() instead of SDO_UTIL.TO_WKTGEOMETRY() and then converting it to an ogr geometry with ogr.CreateGeometryFromGML()

volcan01010 commented 2 years ago

Thanks @sophie-taylor - I think that this issue relates to Oracle CLOBs and how they are converted to Python types. There is more discussion on this here: #110

This Stack Overflow post that we looked at before may also be relevant. https://stackoverflow.com/questions/65240867/cant-convert-geometry-to-wkt-ora-13199-to-wktgeometry-clob-write-failed

volcan01010 commented 1 year ago

I'm going to close this as we are no longer using the cxOracle driver. There is further discussion on CLOBs in #110.