you can send line by line. using the built-in bootloader.
http://code.google.com/appengine/docs/python/tools/uploadingdata.html
This is a good article.
and here is my contactloader.py, which I used 2 years ago for reference. it is more sophisticated since I used the latter, but still .....
import datetime
from google.appengine.ext import db
from google.appengine.tools import bulkloader
class Contact(db.Model):
date = db.DateTimeProperty(auto_now_add=True)
owner = db.StringProperty()
companyname = db.StringProperty()
companyemail = db.EmailProperty()
def myfunc(x):
temp = x.split(":mailto:")
if len(temp) > 0:
temp = temp[-1].split(":")
else:
return "defaultvalue"
if len(temp) > 0:
temp = temp[0]
else:
return "defaultvalue"
temp = temp.split("<1>")[0]
if temp is None or len(temp) < 5:
return "defaultvalue"
return temp
def mysecfunc(x):
return x.split("<0>")[0]
class ContactLoader(bulkloader.Loader):
def __init__(self):
bulkloader.Loader.__init__(self, 'Contact',
[
('companyname',mysecfunc),
('owner', lambda x:"somevalue"),
('companyemail',myfunc),
("date",lambda x:datetime.datetime.now()),
])
loaders = [ContactLoader]
source
share