Manager class reference

SimpleManager

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

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

transform(row, previous, model)[source]

specific transform implementation, instantiates one object from a row

BaseManager

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

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()[source]

return all results

save(o)[source]

save object(s) to this list

scan_row(row, previous=None)[source]

scan one row and save to list

Parameters:
  • row – current row to scan
  • previous (list) – list of list of previous objects in this scan
Returns:

list of saved objects

scan_rows(rows)[source]

scan many rows

stats()[source]

return current stats

transform(row, previous, model)[source]

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