To clarify, I'm going to suggest that you are asking about the Model.to_xml () method, and that by efficient you mean one method that you can name that will provide you with a model object.
As you noted, there is no such class in the Model class for the data warehouse API. I think the goal is that the goal of the XML method is to make the model easily exportable to another application, such as a javascript client, or to import into another database or storage engine, similar to using the remote API.
It should be possible to create a function or static method of a specific class Model, which will generate a new model of a certain type from XML parsing. Then you most likely want to do get_or_insert () to write the resulting object.
If you are looking for your own Python serialization method for Python, you can consider pickle.
source share