Here more or less is my Python code.
import cx_Oracle
conn = cx_Oracle.connect( "...")
cursor = conn.cursor()
cursor.execute( "SELECT * FROM test_table" )
row = cursor.fetchone():
for col in row:
print type( col )
if isinstance( col, cx_Oracle.OBJECT):
print "true"
If the underlying column in Oracle is of type GEOMETRY, the Python type will be cx_Oracle.OBJECT. In the output, I will see <type 'cx_Oracle.OBJECT'>
, but it will not be followed by "true"
This is probably because cx_Oracle.OBJECT returns <type 'cx_Oracle.OBJECTVAR'>
How do I determine if the type is cx_Oracle.OBJECT?
I recognize that there are many ways that I could approach this problem without needing to deal with this question (eg str(type(col))
and compare as a string), but now I just want to understand the correct way to do in Python.