Werner,

Thank you for your response, very kind of you. This looks to be more
what I'm looking for, after a quick test it seems that it is now
applying the limit at the SQL level which is definitly a good thing.

Where abouts in the documentation did you find that? Look here:
http://www.sqlalchemy.org/docs/05/ormtutorial.html is seems to
reccomend the same method as reccomended by the first repsonder, is
that a fault in the docs perhaps?

The next challegne I've noticed with using Limit() is that it doesnt
appear to return an array of objects, but instead, a query object, so
when I try and perform an evaluation on it like so:

if len(the_objects):

I get an error which states:

TypeError: object of type 'Query' has no len()

Why is this? Does using Limit() mean that we're returning query
objects instead of the array of objects I was getting before?

Many thanks,

Heston

On Sep 24, 4:27 pm, "Werner F. Bruhin" <[EMAIL PROTECTED]> wrote:
> Heston,
>
> Heston James wrote:
> > Hi,
>
> > Thanks for the response, that gave me a good foot in the door to this.
> > I've now appened my existing query with.
>
> > .order_by('myobject.created')[:1000]
>
> Just tried this on a simple example:
>
> query = query.limit(500)
>
> Quote from doc for 0.5rc1:
>
> *def limit(/self/, /limit/)*
>
> Apply a LIMIT to the query and return the newly resulting Query.
>
> *def offset(/self/, /offset/)*
>
> Apply an OFFSET to the query and return the newly resulting Query.
>
> *def slice(/self/, /start/, /stop/)*
>
> apply LIMIT/OFFSET to the Query based on a range and return the newly
> resulting Query.
>
> Werner
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to