Hi,

I am working on Oracle support for GeoAlchemy and having problems when
trying to insert NULL values into geometry columns.

spot_null = Spot(spot_height=None, spot_location=None)
session.add(spot_null)
session.commit();

DatabaseError: (DatabaseError) ORA-00932: inconsistent datatypes:
expected MDSYS.SDO_GEOMETRY got CHAR
 'INSERT INTO spots (spot_id, spot_height, spot_location) VALUES
(spots_id_seq.nextval, :spot_height, :spot_location) RETURNING
spots.spot_id INTO :ret_0' {'spot_location': None, 'spot_height':
None, 'ret_0': <cx_Oracle.NUMBER with value None>}


The problem is that Oracle requires a type for bind parameters, and
cx_Oracle -when using None- choses CHAR, because 'CHAR seems the most
likely to cause the least difficulties', see [1]. I hope cx_Oracle
will provide a proper way to use NULL for Oracle objects in near
future.

But right now I am wondering if there is still a way to insert NULL
values into geometry columns. Does SQLAlchemy maybe have a column
flag, so that the column is not used as bind parameter? Or something
else?

At the moment as workaround I set the attribute of my object to a
select that queries NULL. It works but that is not a solution:

spot_null = Spot(spot_height=None,
spot_location=select([text('NULL')], from_obj=['dual']))
..

Thanks,
Tobias


[1]: 
http://sourceforge.net/mailarchive/message.php?msg_name=49F050EC.30205%40gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to