Hi,

I'm having a bit of trouble understanding how to use parents/children
properties within transactions.

I have divided up my "Thumbnails" and the actual "Large Image" into
two separate models to save processing power, but when I upload, I
want to make sure that both entities are updated--therefore I have to
use transactions.

Short version (incase the answer is something simple):
==========================================
Can I query to find out the children entities of a Parent entity?

Long Version:
===========
Key fact - thumbnails is connected to the Large Image (bin) via the
column "bin_id"

The code in Exhibit 1 doesn't work because I get the 'error
"ImageThumb" must have a complete key before it can be used as a
parent'. So I tried to:
1.  .put() ImageThumb
2. assign it as a parent
3. .put() Bin (the large image)
4. get the ID from step 3
5. insert the id in the ImageThumb and .put() it again.

I got the error:  you can't put an entity more than once in appengine!

So my last resort was to just get rid of binID and do steps 1-3. This
works! But now i'm stuck as to getting the Large Image (child) for a
specific thumbnail(parent).

Code Exhibit 1
======================
def uploadImages(self):
                        thumb_db = ImageThumb()
                        thumb = images.resize(image_data,
150,150,images.JPEG)
                        thumb_db.thumb = db.Blob(thumb)

                        bin_db = ImageBin(parent=thumb_db)
                        bin_db.image = image_data
                        bin_put=bin_db.put()
                        bin_id = bin_put.id()

                        thumb_db.binId = bin_id <<=== need binId so
that thumbnail is linked to actual image (so I can use get by id
class)

                        thumb_db.type= "Picture"
                        thumb_put = thumb_db.put()
                        thumb_id = thumb_put.id()


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to