On May 15, 2007, at 2:45 AM, Sanjay wrote:
> >>>> a. Observed that SelectResults was having a count() method. If we >>>> don't use SelectResults, either we have to query the database for >>>> getting the count manually, or use len(list). Using 'len' may >>>> not be >>>> recommended in paginated data grids. >> >> query has a count() method as well. > > Then, what is a way to know the count in situations like this? > > persons = Person.select_by(surname='Patel') > row_count = persons.count() # produces error as > persons is a list object > session.query(Person).count(surname='Patel') >>>> b. Seeing the TurboGears code for 'paginate', it checks for the >>>> type >>>> of variable. If it is a list, it just applies len(list)! Does that >>>> mean, we have to explicitly use SelectResults with TurboGears? >> >> Pylons has taken this issue into account with its own paginage >> function: >> >> http://pylonshq.com/docs/0.9.5/module-webhelpers.pagination.html >> >> the size of the list is passed separately (which is typically >> achieved via a single count() call), if not present uses len(list). >> TG should follow this example. > > Started some discussion in TG group on this. Is there any plan to drop > SelectResults from SQLAlchemy before TG is taken care, it might create > some problem to user like me. its already deprecated. the module itself will probably not be "dropped" for quite some time. > >> this was a small bug that was fixed in trunk a few weeks ago. >> SelectResults is deprecated anyway and its easier to use query >> directly. > > A near future release covers this? the SR bug fix will be in 0.3.8 / 0.4.0 whichever is first. trunk is available right now. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
