[AIRFLOW-938] Use test for True in task_stats queries
[AIRFLOW-938] Use test for True in task_stats queries

Fix a bug with the task_stats query on postgres which doesn't support
== 1.

https://issues.apache.org/jira/browse/AIRFLOW-938

I've seen the other PR but I'll try to see if this
method works because I believe `__eq__(True)` is
just `== True`, and it is how it is down here http
://docs.sqlalchemy.org/en/latest/core/sqlelement.h
tml#sqlalchemy.sql.expression.and_ (underscore is
part of link)

Closes #2123 from saguziel/aguziel-fix-task-
stats-2

RealImpactAnalytics/airflow,cjqian/incubator-airflow,DinoCow/airflow,adrpar/incubator-airflow,yk5/incubator-airflow,adamhaney/airflow,andyxhadji/incubator-airflow,AllisonWang/incubator-airflow,apache/airflow,andyxhadji/incubator-airflow,skudriashev/incubator-airflow,jesusfcr/airflow,OpringaoDoTurno/airflow,Fokko/incubator-airflow,zack3241/incubator-airflow,spektom/incubator-airflow,mattuuh7/incubator-airflow,Fokko/incubator-airflow,adamhaney/airflow,adamhaney/airflow,mrkm4ntr/incubator-airflow,wolfier/incubator-airflow,AllisonWang/incubator-airflow,mattuuh7/incubator-airflow,stverhae/incubator-airflow,airbnb/airflow,CloverHealth/airflow,criccomini/airflow,lyft/incubator-airflow,CloverHealth/airflow,danielvdende/incubator-airflow,mistercrunch/airflow,cjqian/incubator-airflow,skudriashev/incubator-airflow,mrkm4ntr/incubator-airflow,wooga/airflow,hgrif/incubator-airflow,alexvanboxel/airflow,bolkedebruin/airflow,wooga/airflow,yk5/incubator-airflow,spektom/incubator-airflow,holygits/incubator-airflow,asnir/airflow,dgies/incubator-airflow,malmiron/incubator-airflow,RealImpactAnalytics/airflow,jfantom/incubator-airflow,janczak10/incubator-airflow,sid88in/incubator-airflow,mattuuh7/incubator-airflow,DinoCow/airflow,ronfung/incubator-airflow,ProstoMaxim/incubator-airflow,bolkedebruin/airflow,sergiohgz/incubator-airflow,ProstoMaxim/incubator-airflow,KL-WLCR/incubator-airflow,holygits/incubator-airflow,brandsoulmates/incubator-airflow,wndhydrnt/airflow,RealImpactAnalytics/airflow,ronfung/incubator-airflow,zoyahav/incubator-airflow,rishibarve/incubator-airflow,andrewmchen/incubator-airflow,cfei18/incubator-airflow,gtoonstra/airflow,sekikn/incubator-airflow,Twistbioscience/incubator-airflow,stverhae/incubator-airflow,jhsenjaliya/incubator-airflow,criccomini/airflow,apache/incubator-airflow,gilt/incubator-airflow,easytaxibr/airflow,stverhae/incubator-airflow,cfei18/incubator-airflow,nathanielvarona/airflow,KL-WLCR/incubator-airflow,KL-WLCR/incubator-airflow,mrkm4ntr/incubator-airflow,holygits/incubator-airflow,Tagar/incubator-airflow,janczak10/incubator-airflow,fenglu-g/incubator-airflow,gilt/incubator-airflow,hamedhsn/incubator-airflow,jgao54/airflow,sid88in/incubator-airflow,alexvanboxel/airflow,owlabs/incubator-airflow,jgao54/airflow,dmitry-r/incubator-airflow,NielsZeilemaker/incubator-airflow,andrewmchen/incubator-airflow,AllisonWang/incubator-airflow,aminghadersohi/airflow,bolkedebruin/airflow,sergiohgz/incubator-airflow,mtagle/airflow,OpringaoDoTurno/airflow,apache/incubator-airflow,hgrif/incubator-airflow,jesusfcr/airflow,andyxhadji/incubator-airflow,yati-sagade/incubator-airflow,rishibarve/incubator-airflow,skudriashev/incubator-airflow,vijaysbhat/incubator-airflow,MortalViews/incubator-airflow,brandsoulmates/incubator-airflow,lxneng/incubator-airflow,wolfier/incubator-airflow,hamedhsn/incubator-airflow,sekikn/incubator-airflow,Tagar/incubator-airflow,mtagle/airflow,artwr/airflow,zoyahav/incubator-airflow,ProstoMaxim/incubator-airflow,apache/airflow,gilt/incubator-airflow,cfei18/incubator-airflow,OpringaoDoTurno/airflow,hamedhsn/incubator-airflow,preete-dixit-ck/incubator-airflow,easytaxibr/airflow,edgarRd/incubator-airflow,apache/incubator-airflow,janczak10/incubator-airflow,andrewmchen/incubator-airflow,wolfier/incubator-airflow,jesusfcr/airflow,wileeam/airflow,fenglu-g/incubator-airflow,sdiazb/airflow,adrpar/incubator-airflow,dhuang/incubator-airflow,danielvdende/incubator-airflow,aminghadersohi/airflow,wndhydrnt/airflow,alexvanboxel/airflow,Acehaidrey/incubator-airflow,dgies/incubator-airflow,dhuang/incubator-airflow,Fokko/incubator-airflow,edgarRd/incubator-airflow,stverhae/incubator-airflow,airbnb/airflow,fenglu-g/incubator-airflow,dgies/incubator-airflow,wooga/airflow,apache/airflow,lyft/incubator-airflow,apache/airflow,asnir/airflow,MortalViews/incubator-airflow,sekikn/incubator-airflow,jfantom/incubator-airflow,yk5/incubator-airflow,r39132/airflow,wooga/airflow,wileeam/airflow,subodhchhabra/airflow,subodhchhabra/airflow,jgao54/airflow,mtagle/airflow,cfei18/incubator-airflow,easytaxibr/airflow,ronfung/incubator-airflow,CloverHealth/airflow,r39132/airflow,bolkedebruin/airflow,lxneng/incubator-airflow,janczak10/incubator-airflow,wileeam/airflow,dmitry-r/incubator-airflow,cjqian/incubator-airflow,danielvdende/incubator-airflow,RealImpactAnalytics/airflow,gilt/incubator-airflow,N3da/incubator-airflow,dgies/incubator-airflow,mistercrunch/airflow,brandsoulmates/incubator-airflow,apache/airflow,holygits/incubator-airflow,AllisonWang/incubator-airflow,rishibarve/incubator-airflow,MetrodataTeam/incubator-airflow,malmiron/incubator-airflow,jfantom/incubator-airflow,spektom/incubator-airflow,andyxhadji/incubator-airflow,jiwang576/incubator-airflow,akosel/incubator-airflow,artwr/airflow,lxneng/incubator-airflow,N3da/incubator-airflow,nathanielvarona/airflow,jiwang576/incubator-airflow,vijaysbhat/incubator-airflow,apache/airflow,wndhydrnt/airflow,ronfung/incubator-airflow,KL-WLCR/incubator-airflow,Twistbioscience/incubator-airflow,brandsoulmates/incubator-airflow,nathanielvarona/airflow,criccomini/airflow,sid88in/incubator-airflow,Acehaidrey/incubator-airflow,preete-dixit-ck/incubator-airflow,edgarRd/incubator-airflow,dhuang/incubator-airflow,zoyahav/incubator-airflow,Fokko/incubator-airflow,nathanielvarona/airflow,wileeam/airflow,cfei18/incubator-airflow,fenglu-g/incubator-airflow,lyft/incubator-airflow,lxneng/incubator-airflow,hgrif/incubator-airflow,nathanielvarona/airflow,dmitry-r/incubator-airflow,asnir/airflow,mrares/incubator-airflow,yati-sagade/incubator-airflow,skudriashev/incubator-airflow,NielsZeilemaker/incubator-airflow,mattuuh7/incubator-airflow,sdiazb/airflow,danielvdende/incubator-airflow,jhsenjaliya/incubator-airflow,aminghadersohi/airflow,owlabs/incubator-airflow,nathanielvarona/airflow,danielvdende/incubator-airflow,Tagar/incubator-airflow,alexvanboxel/airflow,yati-sagade/incubator-airflow,adamhaney/airflow,aminghadersohi/airflow,edgarRd/incubator-airflow,artwr/airflow,akosel/incubator-airflow,wndhydrnt/airflow,cfei18/incubator-airflow,MortalViews/incubator-airflow,Acehaidrey/incubator-airflow,MortalViews/incubator-airflow,sergiohgz/incubator-airflow,Twistbioscience/incubator-airflow,zack3241/incubator-airflow,preete-dixit-ck/incubator-airflow,CloverHealth/airflow,owlabs/incubator-airflow,NielsZeilemaker/incubator-airflow,Acehaidrey/incubator-airflow,jfantom/incubator-airflow,mtagle/airflow,cjqian/incubator-airflow,adrpar/incubator-airflow,jesusfcr/airflow,jiwang576/incubator-airflow,rishibarve/incubator-airflow,adrpar/incubator-airflow,MetrodataTeam/incubator-airflow,DinoCow/airflow,vijaysbhat/incubator-airflow,Acehaidrey/incubator-airflow,andrewmchen/incubator-airflow,vijaysbhat/incubator-airflow,NielsZeilemaker/incubator-airflow,sdiazb/airflow,lyft/incubator-airflow,jiwang576/incubator-airflow,jhsenjaliya/incubator-airflow,r39132/airflow,danielvdende/incubator-airflow,hamedhsn/incubator-airflow,N3da/incubator-airflow,gtoonstra/airflow,mrares/incubator-airflow,MetrodataTeam/incubator-airflow,wolfier/incubator-airflow,hgrif/incubator-airflow,Twistbioscience/incubator-airflow,preete-dixit-ck/incubator-airflow,easytaxibr/airflow,asnir/airflow,malmiron/incubator-airflow,mrkm4ntr/incubator-airflow,bolkedebruin/airflow,dmitry-r/incubator-airflow,akosel/incubator-airflow,DinoCow/airflow,zack3241/incubator-airflow,subodhchhabra/airflow,dhuang/incubator-airflow,criccomini/airflow,gtoonstra/airflow,sekikn/incubator-airflow,subodhchhabra/airflow,Acehaidrey/incubator-airflow,artwr/airflow,sid88in/incubator-airflow,gtoonstra/airflow,sdiazb/airflow,owlabs/incubator-airflow,airbnb/airflow,ProstoMaxim/incubator-airflow,MetrodataTeam/incubator-airflow,mistercrunch/airflow,yati-sagade/incubator-airflow,Tagar/incubator-airflow,zoyahav/incubator-airflow,malmiron/incubator-airflow,yk5/incubator-airflow,airbnb/airflow,r39132/airflow,jhsenjaliya/incubator-airflow,OpringaoDoTurno/airflow,apache/incubator-airflow,mrares/incubator-airflow,sergiohgz/incubator-airflow,zack3241/incubator-airflow,spektom/incubator-airflow,akosel/incubator-airflow,mrares/incubator-airflow,mistercrunch/airflow,N3da/incubator-airflow,jgao54/airflow