We are looking for this type of statement, but when trying it, it doesn't work:
if type(item) == "<type 'oracle.sql.BLOB'>"
Background: We are receiving BLOB type objects back from a JDBC connection in Jython. We are trying to check whether the type of a column returned is of type so we know to decode the binary object.
What else we have tried: Other answers to questions show examples where they use the class name (i.e. type(i) is int) as a test - but in this case, if we use the supposed class name like this:
if type(item) == oracle.sql.BLOB:
We get this error:
NameError: name 'oracle' is not defined
Multiple other answers to questions of this type mention using isinstance() as a preferable method for checking types - but all the answers we saw showed coders using existing objects of that type to test against.
Yet, in this instance, we don't have an object of that oracle blob type.
How do we test for a object type? Or, how do we create an object of that type so we can use isinstance()? Or is there another approach?