Closed faridanthony closed 3 years ago
If I'm understanding you correctly, len(self.db['users'])
should do the trick :)
@pudo is there a way to retrieve the number of records filtered by find()
? len()
does not work for this case, raising a TypeError: object of type 'ResultIter' has no len()
Oh, okay, you have to use table.count(**filter_clause)
to get it.
records = self.db['users'].all()
I have tried: len(records) records.count() records.rowcount
<class 'TypeError'>: object of type 'ResultIter' has no len() AttributeError: 'ResultIter' object has no attribute 'count()' AttributeError: 'ResultIter' object has no attribute 'count'
to no avail. I'm using this to populate a table and I need to be able to set the number of rows based on the number of records retrieved in my query. Thanks!