[cx-oracle-users] Inserting 'None' values
Brought to you by:
atuining
From: Tobias S. <tob...@ca...> - 2010-05-18 11:20:21
|
Hi, I am trying to use a Python 'None' value as bind parameter for a geometry column in an insert statement, but this does not work: >>> cursor.executemany('insert into spots values(:id, :height, :geom)', [{'id': 14, 'height': 2, 'geom': None}]) Traceback (most recent call last): File "<stdin>", line 1, in <module> cx_Oracle.DatabaseError: ORA-00932: inconsistent datatypes: expected MDSYS.SDO_GEOMETRY got CHAR >>> cursor.executemany('insert into spots values(:id, :height, NULL)', [{'id': 14, 'height': 2}]) >>> I don't know what query is actually sent to the database, but it seems as if 'None' is not converted to 'NULL'. And using 'None' as bind parameter for the decimal column 'height' works. Is this a bug? Thanks, Tobias |