I am reading from an Oracle database and would like to check if the field is column is of type cx_Oracle.DATETIME
.
I have tried the following:
if columnTypes[columnIndex] == cx_Oracle.DATETIME:
and
if columnTypes[columnIndex] is cx_Oracle.DATETIME:
Neither work.
If I do:
print columnTypes[columnIndex]
it returns:
<type 'cx_Oracle.DATETIME'>
EDIT:
It worked by storing the type in a variable:
dbDateType = cx_Oracle.DATETIME
and
if columnTypes[columnIndex] == dbDateType