Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Boolean field query with sqlalchemy

Postgres model:

class Song(db.Model):
    id3_parsed = db.Column(db.Boolean, server_default=u'false')

Running the following query gives the correct count:

select count(*) from song where id3_parsed is false;

But how do I do it with flask-sqlalchemy? This doesn't work:

songs = Song.query.filter(Song.id3_parsed == False).all()
like image 744
Tjorriemorrie Avatar asked Aug 04 '15 13:08

Tjorriemorrie


1 Answers

songs = Song.query.filter(Song.id3_parsed.is_(False)).all()
like image 65
Tjorriemorrie Avatar answered Sep 29 '22 23:09

Tjorriemorrie