I used to use construction like this: rows_count=db(db.autos.out=='T').count(), but my real query consists of many conditions. So I decided to use executesql.
By the way, I wrote the code: rows_count = db.executesql("SELECT count(1) FROM autos WHERE autos.out='T' and autos.out='F' and autos.idk='F' and autos.svh='F' and autos.rad='F' and autos.out='F' and autos.tranzit='F'", as_dict=False) rows_count=rows_count[0][0] I think this construction is more preferable for me. And thank you very much for the help. Your advice was very helpfull for me. ********************************************************** On 23 апр, 21:35, Vasile Ermicioi <elff...@gmail.com> wrote: > but it is nicer if you have models (you can generate them from database > tables) > > print db(db.autos.out=='T').count()