Model class reference

This document covers features of the Model class.

Model

class data_migrator.models.base.Model(**kwargs)[source]

Model is foundation for every transformation.

Each non-abstract Model class must have a BaseManager instance added to it. data-migrator ensures that in your model class you have at least a standard SimpleManager specified, on case you do add your own specialization of BaseManager through the Meta class manager attribute.

objects

reference to manager

emit(escaper=None)[source]

output and escape this object instance to a dict.

Returns:object transfored according to field definitions
Return type:map

Note

HiddenFields are not emitted

classmethod json_schema()[source]

generate the json schema representation of this model.

Returns:dict with python representation of json schema.
save()[source]

Save this object and add it to the list.

Returns:self, so that methods can be chained
scan(row)[source]

scan model from row based on field definition scanners.

Returns:self, so that methods can be chained
update(**kwargs)[source]

Update method for chaining operations.

Returns:self, so that methods can be chained
Raises:DataException – raised if trying to set non defined field and strict model.

ModelBase

class data_migrator.models.base.ModelBase[source]

Metaclass for all models.

Note

the model structure is the foundation of data-migrator and is taken from Django (https://github.com/django/django)