Skip to content

Incorrect geometry coordinates generated by SDO_UTIL.FROM_GEOJSON when executed from python-oracledb #547

@120m4n

Description

@120m4n
  1. What versions are you using?

Oracle Database version: 19c

Oracle Client version (Thick mode): N/A (using Thin mode)

Python environment details:

platform.platform: macOS-14.5-arm64-i386-64bit
sys.maxsize > 2**32: True
platform.python_version: 3.11.4
oracledb.__version__: 2.5.1
  1. Is it an error or a hang or a crash?

This is an error resulting in incorrect behavior: SDO_UTIL.FROM_GEOJSON produces invalid geometry coordinates when executed from python-oracledb, while the same query works correctly in other Oracle clients.

  1. What error(s) or behavior you are seeing?

When executing an UPDATE statement using SDO_UTIL.FROM_GEOJSON on valid GeoJSON data stored as CLOB, the resulting SDO_GEOMETRY contains repeated, incorrect coordinate values instead of the correct ones from the GeoJSON.

Example:

Valid GeoJSON stored in CLOB: {"type": "Polygon", "coordinates": [[[-76.55877738801469, 3.280998964835081], [-76.558268804142315, 3.282665800392131], ...]]}
UPDATE query:

UPDATE table 
SET geom = SDO_UTIL.FROM_GEOJSON(geojson_data)

Expected: Correct SDO_GEOMETRY with proper coordinates.
Actual: SDO_COORDINATES shows repeated values like {-76,3,-76,3,-76,3,-76,3,...} for all points, resulting in invalid geometry.
The same UPDATE query executed directly in DBeaver produces correct, valid geometry. No Python exceptions are raised; the geometry is created but with wrong coordinates.

Steps to reproduce:

  • Create table:
CREATE TABLE test_geojson (id NUMBER, geojson_data CLOB, geom SDO_GEOMETRY);
  • Insert valid GeoJSON into geojson_data.
  • Run UPDATE from python-oracledb.
  • Inspect geom - coordinates are incorrect.
  • Run same UPDATE in DBeaver - coordinates are correct.
  1. Does your application call init_oracle_client()?

No, the application does not call init_oracle_client(). It uses Thin mode for the connection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions