count of rows in sqlalcemy code example Example: query to count the number of rows in a table in sqlalchemy UserImage.query.filter(UserImage.user_id == 1).count()