An alternative is to use 

```python
filter = and_(TaskHistory.project_id == id, TaskHistory.update.isnot(None))
```

In this way flake8 should not complain, even w/o the `# noqa` flag.

This is in the SQLA doc: http://docs.sqlalchemy.org/en/rel_0_9/orm/tutorial.html#common-filter-operators.