![]() |
App Engine Python SDK
v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
|
Public Member Functions | |
def | __init__ |
def | get_keys_to_reserve |
def | initialize |
def | finalize |
def | generate_records |
def | generate_key |
def | create_entity |
Public Attributes | |
import_record_iterator | |
dict_to_entity | |
kind | |
bulkload_state | |
reserve_keys | |
keys_to_reserve | |
Generic Bulkloader import class for input->dict->model transformation. The bulkloader will call generate_records and create_entity, and we'll delegate those to the passed in methods.
def google.appengine.ext.bulkload.bulkloader_config.GenericImporter.__init__ | ( | self, | |
import_record_iterator, | |||
dict_to_entity, | |||
name, | |||
reserve_keys | |||
) |
Constructor. Args: import_record_iterator: Method which yields neutral dictionaries. dict_to_entity: Method dict_to_entity(input_dict) returns model or entity instance(s). name: Name to register with the bulkloader importers (as 'kind'). reserve_keys: Method ReserveKeys(keys) which will advance the id sequence in the datastore beyond each key.id(). Can be None.
def google.appengine.ext.bulkload.bulkloader_config.GenericImporter.create_entity | ( | self, | |
values, | |||
key_name = None , |
|||
parent = None |
|||
) |
Creates entity/entities from input values via the dict_to_entity method. Args: values: Neutral dict from generate_records. key_name: record number from generate_key. parent: Always None in this implementation of a Loader. Returns: Entity or model instance, or collection of entity or model instances, to be uploaded.
def google.appengine.ext.bulkload.bulkloader_config.GenericImporter.finalize | ( | self | ) |
Performs finalization actions after the upload completes. If keys with numeric ids were used on import, this will call AllocateIds to ensure that autogenerated IDs will not raise exceptions on conflict with uploaded entities.
def google.appengine.ext.bulkload.bulkloader_config.GenericImporter.generate_key | ( | self, | |
line_number, | |||
unused_values | |||
) |
Bulkloader method to generate keys, mostly unused here. This is called by the bulkloader just before it calls create_entity. The line_number is returned to be passed to the record dict, but otherwise unused. Args: line_number: Record number from the bulkloader. unused_values: Neutral dict from generate_records; unused. Returns: line_number for use later on.
def google.appengine.ext.bulkload.bulkloader_config.GenericImporter.generate_records | ( | self, | |
filename | |||
) |
Iterator yielding neutral dictionaries from the connector object. Args: filename: Filename argument passed in on the command line. Returns: Iterator yielding neutral dictionaries, later passed to create_entity.
def google.appengine.ext.bulkload.bulkloader_config.GenericImporter.get_keys_to_reserve | ( | self | ) |
Required as part of the bulkloader Loader interface. At the moment, this is not actually used by the bulkloader for import; instead we will reserve keys if necessary in finalize. Returns: List of keys to reserve, currently always [].
def google.appengine.ext.bulkload.bulkloader_config.GenericImporter.initialize | ( | self, | |
filename, | |||
loader_opts | |||
) |
Performs initialization. Merely records the values for later use. Args: filename: The string given as the --filename flag argument. loader_opts: The string given as the --loader_opts flag argument.