db.Query and cursor

20 views
Skip to first unread message

Paul Kinlan

unread,
Oct 14, 2009, 3:03:15 PM10/14/09
to google-a...@googlegroups.com
Hi Guys,

Just browsing the source for the 1.2.6 to see if there is support for querying multiple ancestors (something I think I need but I don't think is supported) and I noticed that _BaseQuery and Query has compilation options and associated cursor support.  Is this for iterating across results > 1000?

Is there anymore documentation about this?

Paul.

Rodrigo Moraes

unread,
Oct 14, 2009, 3:13:55 PM10/14/09
to google-a...@googlegroups.com
On Wed, Oct 14, 2009 at 4:03 PM, Paul Kinlan wrote:
> Hi Guys,
> Just browsing the source for the 1.2.6 to see if there is support
> for querying multiple ancestors (something I think I need but I don't think
> is supported) and I noticed that _BaseQuery and Query has compilation
> options and associated cursor support.  Is this for iterating across results
>> 1000?

I played with cursors a little bit, and while they work on dev server,
in production query.cursor() seems to always return None. It's not
officially released, so nothing to complaint. :-(

Here's a basic example:

query = MyModel.all()
results = query.fetch(10)
cursor = query.cursor()

for the next query, you can use the cursor:

query = MyModel.all().with_cursor(cursor)
results = query.fetch(10)

This second query will start where the later stopped.

-- rodrigo

Paul Kinlan

unread,
Oct 14, 2009, 3:18:38 PM10/14/09
to google-a...@googlegroups.com
For sure, that is what I was thinking would be happening.  Was wondering if anyone had tried it to see if it was working yet (since it wasn't in the release notes).

P

2009/10/14 Rodrigo Moraes <rodrigo...@gmail.com>
Reply all
Reply to author
Forward
0 new messages