JSONDecodeError on empty CLOB · Issue #429 · oracle/python-oracledb (original) (raw)
- What versions are you using?
19
platform.platform Linux-3.10.0
sys.maxsize > 2**32 True
platform.python_version 3.12.7
oracledb.version 2.5.0
- Is it an error or a hang or a crash?
Exception crash
- What error(s) or behavior you are seeing?
When selecting a CLOB column which contains nothing, which I suppose is what the DB considers as an empty string, the driver crashes with JSONDecodeError.
- Does your application call init_oracle_client()?
No, thin mode
- Include a runnable Python script that shows the problem.
Working on this, I can't even have github from the machine where I'm having this case, trying to reproduce locally with an express container although I'm not a DBA ...
Meanwhile, according to the traceback I see, I think this
https://github.com/oracle/python-oracledb/blob/main/src/oracledb/impl/base/cursor.pyx#L134
Should be changed to
try: return json.loads(value) except json.JSONDecodeError: return value
This will allow fetchall to work even if a CLOB is empty.