Manager class reference

SimpleManager

class data_migrator.models.manager.SimpleManager(*args, **kwargs)

The default manager to handle models, all standard logic and generates one object per row

transform(row, previous, model)

specific transform implementation, instantiates one object from a row

BaseManager

class data_migrator.models.manager.BaseManager(*args, **kwargs)

BaseManager is the foundation for all managers, contains to base logic to maintain models: parse, keep and emit.

Extend this class for actual managers

all()

return all results

save(o)

save object(s) to this list

scan_row(row, previous=None)

scan one row and save to list

scan_rows(rows)

scan many rows

stats()

return current stats

transform(row, previous, model)

defines the instantiation of objects from a row

Override this function in your own manager. Models are ordered and generated records are offered in the consequtives managers too.

Parameters:
  • row (list) – all input data for a new row
  • previous (list) – all generated objects from previous managers in chain
  • model (Model) – Model this manager is linked to
Returns:

list of all generated objects