I am getting this error:
TypeError: 'BaseQuery' object is not callable
Here is my code:
companies = Company.query.all()
return Company.query(func.count(Company.id))
I need to find out number of rows in Company model. Please help!
Company.query
isnt callable there. If you've already selected all your companies with companies = Company.query.all()
, why not simply use len(companies)
?
If you dont want/need to retrieve the data, you can get just the count with Company.query.count()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With