Reputation: 17282
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()
Upvotes: 16
Views: 22274
Reputation: 966
Your query seems to be right, looks like this is flake8 issue.
And that you can ignore by adding # noqa
in the line you wrote.
Upvotes: 2
Reputation: 17282
songs = Song.query.filter(Song.id3_parsed.is_(False)).all()
Upvotes: 49