Is it possible to bulk load an NDB child Entity in GAE?
Posted
by
hmacread
on Stack Overflow
See other posts from Stack Overflow
or by hmacread
Published on 2014-05-21T03:38:42Z
Indexed on
2014/05/30
9:27 UTC
Read the original article
Hit count: 192
python-2.7
|app-engine-ndb
At some point in the future I may need to bulk load migration data (i.e. from a CSV). Has anyone had exceptions raised doing the following? Also is there any change in behaviour if the ndb.put_multi() function is used?
from google.appengine.ext import ndb
while True:
if not id:
break
id, name = read_csv_row(readline())
x = X(parent=ndb.Key('Y','static_id')
x.id, x.name = id, name
x.put()
class X(ndb.Model):
id = StringProperty()
name = StringProperty()
class Y(ndb.Model):
pass
def read_csv_row(line):
"""returns tuple"""
© Stack Overflow or respective owner