0

In flask, I have defined a model where the columns are like id,name,status, etc. And the status value can be -1, 0 ,1,2,.... (-1 is allowed for -ve number except that all are +ve numbers) I want to find count of all the records where the status is not equal to -1. or I can say count of all records where status is greater than equal to 0.

what I have tried is, I am writing code as - Modelname.query.filter_by(status!= -1).count() or Modelname.query.filter_by(status >= 0).count()

But I am getting error like status is not defined in both the cases as filter_by doesn't support != and I have tried with only filter but got same error and if I use status= -1 then I'm not getting this error.

Dcoder14
  • 1,831
  • 3
  • 12
  • 22

0 Answers0