Sorry... I was offline for a while (thanks, telco)...

On Tuesday 06 February 2007 00:43, David Smith wrote:
> Regarding queries, you don't need them when you're using
> assign_mapper

For "normal" queries like model.mytable.get_by(name='Chris') it's great to 
use the additional methods that assign_mapper gives me. [1] And it's also 
easy to paginate a whole database table. But what if I want to page only 
through mytable where certain criteria match? Like I just want to see 
pages of entries that start with 'C'. As soon as I give the paginator 
something like model.mytable.select() I select everything and don't use 
proper LIMITs. Understood. But what is the correct way to pass something 
to the paginator? I thought of something like:

  paginator.paginate(model.mytable.query(name.like='C%')

> Anyway, I sent up a patch to fix the paginator. Try it
> out. With the patch, you send the paginator anything with count
> and select methods, like model.Person or a select and where
> clause.

I'm not sure why you/we don't just take the object class that a query is 
derived from. Why is isinstance(obj, 'sqlalchemy.orm.query') wrong?

Cheers
 Christoph
 (who still didn't give up with his paginator redesign)

[1] By the way I found the URL where these methods are documented just in 
case anyone wonders... 
http://www.sqlalchemy.org/docs/plugins.myt#plugins_assignmapper

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to