Hi Will,

As the error message says, the only queries you can execute inside a
transaction are ancestor queries. You need to execute the query outside the
transation then, if necessary, check the preconditions still hold inside the
transaction.

-Nick Johnson

On Sun, Nov 8, 2009 at 4:04 AM, Will <[email protected]> wrote:

> Hi all,
>
> I got this error when I tried to run a query in a transaction, "Only
> ancestor queries are allowed inside transactions".
>
> I have a class, C1, whose entities have no ancestors. I want to query a
> particular entity from it, modify, and put it back, for example,
>
> item = C1.gql("WHERE p1 = :a AND p2 = :b ORDER BY p2", a = None, b =
> 23).fetch(1)
> item.p1 = sth
> item.put()
>
> The above code should run in a transaction. What should I do?
>
> Thanks in advance.
>
> Will
>
>
>
> >
>


-- 
Nick Johnson, Developer Programs Engineer, App Engine
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number:
368047

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

Reply via email to