I have got the answer. I edited the file bulkloader.py 2513line
original: properties[name] = converter(val) now: if val=='None': properties[name] = None else: properties[name] = converter(val) On 5月10日, 上午10时59分, Mandla <msg.mand...@gmail.com> wrote: > Hi, all > I have a java project on app engine, and I use python based code tobackupmy > datastore. > > jdo > class------------------------------------------------------------------------ > public class PaymentUser { > @PrimaryKey > private String transId; > @Persistent > private String media; > @Persistent > private float fee; > @Persistent > private String currency; > @Persistent > privatelongtimestamp; > > //getters and setter... > > } > > Thebackuppython > code:--------------------------------------------------------- > from google.appengine.ext import db > from google.appengine.tools import bulkloader > import sys > reload(sys) > sys.setdefaultencoding('utf-8') > > class PaymentUser(db.Model): > media = db.StringProperty() > fee = db.FloatProperty() > currency = db.StringProperty() > timestamp = db.IntegerProperty() > > def AddKeys(entity_generator): > for entity in entity_generator: > entity['key'] = entity.key() > yield entity > > class PaymentUserExporter(bulkloader.Exporter): > def __init__(self): > bulkloader.Exporter.__init__(self, 'PaymentUser', > > [('transId', str, None), > > ('media', str, None), > > ('fee', str, None), > > ('currency', str, None), > > ('timestamp', str, None) > ]) > def output_entities(self, entity_generator): > bulkloader.Exporter.output_entities(self, > AddKeys(entity_generator)) > exporters = [PaymentUserExporter] > > class PaymentUserLoader(bulkloader.Loader): > def __init__(self): > bulkloader.Loader.__init__(self, 'PaymentUser', > > [('transId', str), > > ('media', str), > > ('fee', float), > > ('currency', str), > > ('timestamp', int) > ]) > loaders = [PaymentUserLoader] > > And I use appcfg to backing up my data to CSV > file.problems:-------------------------------------------------- > 1.The field currency either some String data or null (not take any > space), because I have tobackupthese strings,so these nulls are.In > my CSV file these nulls are str "None". When I upload these data to > server again,I found original nulls are replaced by string None.Here I > will waste many spaces. > 2. The problem is as same as the first one. But is along > property(timestamp), when I upload the data to server These None > connot be converted tolongvalue, so there are many exceptions. > > How can I solve it, Thanks. > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to google-appengine-j...@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine-java+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/google-appengine-java?hl=en. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.