Third Party Integration Issues
Two errors which can occur are on a backend such as psycopg2, and ArgumentError: SQL expression object expected, got object of type <class 'numpy.bool_'> instead
; in more recent versions of SQLAlchemy this may be ArgumentError: SQL expression for WHERE/HAVING role expected, got True
.
In the latter case, the issue is due to the numpy.int64
datatype overriding the __eq__()
method and enforcing that the return type of an expression is or numpy.False
, which breaks SQLAlchemy’s expression language behavior that expects to return ColumnElement
expressions from Python equality comparisons:
SQL expression for WHERE/HAVING role expected, got True
See I’m getting errors related to “numpy.int64”, “numpy.bool_”, etc..