Google AppEngine entity groups and transactions -


i'm trying transaction work in appengine , i'm running problems entity groups. code bit this:

parent_obj = classa.all().get()  def txn():   key_name = 'hash of here'    if not db.get(db.key.from_path('classb', key_name, parent=parent_obj)):     obj = classb(       parent = parent_obj     )     obj.put()  db.run_in_transaction(txn) 

...but 'cannot operate on different entity groups in transaction' error. don't understand far can see transaction operates on entities in same group. namely, line 6 queries 'parent' same 'parent' set in line 8, both queries concerned same entity group.

i'm left conclude understanding of entity groups wrong. how? i've read docs several times , still don't see how i'm doing wrong.

any ideas? thanks!

this happening because parent_obj none and not passing key_name when creating classb. in case, have multiple entity groups (each entity no ancestor separate group).

this work if parent_obj none or not:

parent_obj = classa.all().get()  def txn():   key_name = 'hash of here'    if not db.get(db.key.from_path('classb', key_name, parent=parent_obj)):     obj = classb(       key_name = key_name,       parent = parent_obj     )     obj.put()  db.run_in_transaction(txn) 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -