You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def OutConverter(value):
if value is None:
return ''
return value
def OutputTypeHandler(cursor, name, defaultType, size, precision, scale):
if defaultType in (cx_Oracle.STRING, cx_Oracle.FIXED_CHAR):
return cursor.var(str, size, cur.arraysize, outconverter=OutConverter)
connection.outputtypehandler = OutputTypeHandler
But the query will still return a result of none.Is it my wrong way to use it or is it a bug?
thank you
The text was updated successfully, but these errors were encountered:
I took a look and realized that the example provided in the documentation is inaccurate! We will have to adjust it and also make clear that the output type handler only handles values that are not null (or the value None). So right now there is no way to make queries return the empty string instead of None. I'll consider a way to deal with that in the future..
One possible solution: add a convert_nulls parameter to cursor.var() which has a default value of False. When True, however, None would be passed through to the outconverter and inconverter functions. This retains the current behavior but gives the option of greater control for those (like you) who would prefer that. Thoughts?
use https://cx-oracle.readthedocs.io/en/latest/user_guide/sql_execution.html#changing-query-results-with-outconverters code
But the query will still return a result of none.Is it my wrong way to use it or is it a bug?
thank you
The text was updated successfully, but these errors were encountered: