Skip to content

Fail to make queries return empty strings instead of NULLs #454

Description

@bigfoxtail

use https://cx-oracle.readthedocs.io/en/latest/user_guide/sql_execution.html#changing-query-results-with-outconverters code

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions