I have a weird problem with querying for strings using Oracle 11g backend for SQLAlchemy. First, class definition (for Oracle, for Postgres it is the same minus Sequence):
class Item(Base):
__tablename__ = 'item'
id = Column(Integer, Sequence('id_seq'), primary_key=True)
...
review = Column(Unicode(2000), index=True)
Basic querying works without a problem with Postgres backend:
In [1]: len(DBSession.query(Item).filter(Item.review != '').limit(100).all())
Out[1]: 100
However, with Oracle 11g:
In [31]: len(DBSession.query(Item).filter(Item.review != '').limit(100).all())
Out[31]: 0
Filtering by empty Unicode string does not work either in Oracle:
In [32]: len(DBSession.query(Item).filter(Item.review != u'').limit(100).all())
Out[32]: 0
Why something so basic does not work with Oracle? And how can I fix that?