I'm using peewee in my Flask application and I have one column in a table which can be null:
somecolumn = ForeignKeyField(Something, related_name='messages', null = True, default=None)
I now want to select all records in which somecolumn is not null/None/Empty. I tried to do this with the following:
Message.select().where(Message.somecolumn != None)
Message.select().where(Message.somecolumn != '')
Unfortunately, neither works. Does anybody know how I can do this? All tips are welcome!
I'm not a peewee expert, but from the documentation (Querying) it looks like you need:
Message.select().where(Message.somecolumn >> None)