This is related to a previous question of mine, but with new information.
I'm trying to configure the bulkdownloader to download data from my Java appengine app in such a way that a list of owned objects is transformed into a nested XML path inside each parent object. I have been using the export transform transform.child_node_from_list
. However, the list property is never actually being downloaded and passed to that transform!
This seems similar to the effect you get when looking at an entity in the appengine datastore viewer - the parent entity just doesn't show the list property at all. You have to access it through code.
My question, then, is this: how can I access this list property with the bulk downloader? If I am downloading with --kind=ParentEntity
, do you think that is stopping it from downloading anything that is a ChildEntity
? (Is there a way to specify "all kinds" or anything?)
In a python download config, the model is actually directly referenced in to the config file. Do I need to mock up a python model that mimics my JDO model and use that reference?
For reference, abbreviated versions of each of my files follow:
downloadconfig.yaml:
transformers:
- kind: ParentEntity
connector: simplexml
connector_options:
xpath_to_nodes: /Parents/Parent
style: element_centric
property_map:
- property: __key__
external_name: key
export_transform: transform.key_id_or_name_as_string
- property: name
external_name: name
# Type: String Stats: 30 properties of this type in this kind.
- property: children
external_name: Children
import_transform:
transform.list_from_child_node('Children/Child')
export_transform:
transform.empty_if_none(transform.child_node_from_list('Child'))
ParentEntity.java:
package experiment.dataexport;
import java.util.List;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import com.google.appengine.api.datastore.Key;
@PersistenceCapable
public class ParentEntity
{
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
public Key key;
@Persistent
public String name;
@Persistent(defaultFetchGroup = "true")
public List<ChildEntity> children;
}
Sample XML output:
<Parents>
<Parent>
<name>Parent 5613</name>
<key>72001</key>
<Children></Children>
</Parent>
<Parent>
<name>Parent 1237</name>
<key>73001</key>
<Children></Children>
</Parent>
</Parents>
(There should be several <Child>
elements in each <Children>
node, but the downloader is retrieving None
instead of the proper list of children)