yes, bulk_insert changed from needing a dict to needing the ** notation at some point. are the docs out of sync?

and look at this: http://code.google.com/appengine/docs/python/datastore/functions.html#put looks like GAE bulk PUT does return a list of keys. perhaps i smell a DAL enhancement coming on!

cfh

On 2/21/12 19:38 , BrendanC wrote:
howesc,

My bad - you are correct. I retested bulk insert on GAE and it does work. I
made a mistake with my syntax:

Instead of:

     imgids = db.imagetag.bulk_insert(ddlist)

I was using:

    imgids = db.imagetag.bulk_insert(**ddlist)

Complete example:

     #Test example - Build a list of dicts to insert
     ddlist = []
     d1 = {'image_id':10, 'tag_id':101 }
     d2 = {'image_id':10, 'tag_id':102 }
     d3 = {'image_id':11, 'tag_id':333 }
     ddlist.append(d1)
     ddlist.append(d2)
     ddlist.append(d3)
     imgids = db.imagetag.bulk_insert(ddlist)

    Unfortunately as you stated earlier, this inserted id's are not returned
- just a True/False indicator.

Reply via email to