From an empty datastore, I was able to auto-generate a bulkloader.yaml
file. It only contains the python_preamble
, but the transformers
section was empty.
python_preamble:
- import: google.appengine.ext.bulkload.transform
- import: google.appengine.ext.bulkload.bulkloader_wizard
- import: my_own_transformers
- import: data_models # This is where the SomeData class is defined.
# some more imports here
Then based on the examples in the documentation, I need to define a property map for each of the columns in my CSV:
transformers:
- kind: SomeData
connector: csv
property_map:
- property: date
import_transform: transform.some_undocumented_function
Two Questions:
My understanding is that the function defined as the import_transform
will transform the ordinary CSV string into a Property Class worthy of the datastore. I want to understand how the transforms work, so I think I have two alternatives.
Where is the library reference for
google.appengine.ext.bulkload.transform
? I want to know how to usetransform.some_undocumented_function
, as well as all the othertransform.some_other_undocumented_transformers
You can see from my
python_preamble
that I- import: my_own_transformers
. In that module, I defined a functiontransform_date
that takes an ISO date string such as2001-01-01
and transforms it into a type that can fit intodb.DateProperty()
. If my concept is correct, can I use:
property_map: - property: date import_transform: my_own_transforms.transform_date
1)
You can check the source code or giving to the interactive console something like this:
you will get:
2)
Exactly, you can use your defined transform functions or, in this specific case, you could directly use
transform.import_date_time
.