google.appengine.ext.bulkload.connector_interface module


Bulkloader interfaces for the format reader/writers.


class google.appengine.ext.bulkload.connector_interface.ConnectorInterfacesource

Bases: object

Abstract base class describing the external Connector interface.

The External Connector interface describes the transition between an external data source, e.g. CSV file, XML file, or some sort of database interface, and the intermediate bulkloader format, which is a dictionary or similar structure representing the external transformation of the data.

On import, the generate_import_record generator is the only method called.

On export, the initialize_export method is called once, followed by a call to write_dict for each record, followed by a call to finalize_export.

The bulkload_state is a BulkloadState object from google.appengine.ext.bulkload.bulkload_config. The interesting properties to a Connector object are the loader_opts and exporter_opts, which are strings passed in from the bulkloader command line.


Performs finalization actions after every record is written.

generate_import_record(filename, bulkload_state)source

A function which returns an iterator over dictionaries.

This is the only method used on import.

  • filename – The –filename argument passed in on the bulkloader command line. This value is opaque to the bulkloader and thus could specify any sort of descriptor for your generator.

  • bulkload_state – Passed in BulkloadConfig.BulkloadState object.


An iterator describing an individual record. Typically a dictionary, to be used with dict_to_model. Typically implemented as a generator.

initialize_export(filename, bulkload_state)source

Initialize the output file.

  • filename – The string given as the –filename flag argument.

  • bulkload_state – Passed in BulkloadConfig.BulkloadState object.

These values are opaque to the bulkloader and thus could specify any sort of descriptor for your exporter.


Write one record for the specified entity.


dictionary – A post-transform dictionary.

google.appengine.ext.bulkload.connector_interface.create_from_options(options, name='unknown')source

Factory using an options dictionary.

This is frequently implemented as the constructor on the connector class, or a static or class method on the connector class.

  • options – Parsed dictionary from yaml file, interpretation is up to the implementor of this class.

  • name – Identifier of this transform to be used in error messages.


An object which implements the ConnectorInterface interface.