Last edition : 2009/04/09 15:39
A simple library to export/import GAE models thru xml serialization.
AEX exposes 2 methods :
Consider this model :
You can do :
which will create a string buf containing the XML data of MyModel's entities. Note that xml is encoded in UTF-8.
If you want to create a XML file, you can do :
If you want to export many models in one XML, you can do like that :
Note thant you pass model class in the exporte method. If it's a model class, all entities of this model will be exported. If you want to export only some entities you can give a query instance like that :
In the case, all entities of MyModel and MyModel3, and entities of Model2 which have name like "me", will be exported.
Import can be done like this, if you import the xml thru a buffer string :
or like this, if you import a xml file :
If the xml contains many models, you should give them to import method, like this :
Note that imported data will always be added in models. If you want to "delete before add", just add the switch delete in import method like this :
Models will be deleted, and filled with data from the xml file.
AEX is young, very young. It works pretty well for me, but could not work for you ... or it could damage your datas.
It may contains BUG. I accept patches ;-)