Batches¶
Checks¶
-
sheraf.batches.checks.
check_attributes_index
(model_instance)¶ For a given model instance compute all the values for all the indexes, then checks the index table if the values match the model instance.
-
sheraf.batches.checks.
check_conflict_resolution
()¶ A simple utility functions that checks that sheraf objects conflict resolution is active.
- Returns
True
if sheraf objects conflicts can be solved, elseFalse
.
>>> from sheraf.batches.checks import check_conflict_resolution >>> with sheraf.connection(): ... assert check_conflict_resolution()
-
sheraf.batches.checks.
check_health
(*args, model_checks=None, instance_checks=None, attribute_checks=None, other_checks=None)¶ Takes some modules in parameters. :param model_checks: If None, check also model consistency (see constant model_check_funcs) :param instance_checks: If None, check all instance consistency rules. Else, give the list of wanted checking rules (see constant instance_check_funcs) :param attribute_checks: If None, check all attribute consistency rules. Else, give the list of wanted checking rules (see constant instance_check_funcs) The function will discover models in the modules, analyze every model instance, and return a health report in JSON. Depending on the result, you may need to apply some migrations.
-
sheraf.batches.checks.
check_model_index
(model)¶ Browse an index_table, and checks that every indexed persistent can be read.
For a given attribute: - If MULTIPLE: an attribute index is ok if all model instances for an attribute value are present - If UNIQUE: an attribute index is ok if the model instances for this attribute value is present :param model: a model (class) :return: a health report dictionary for each model for each attribute.
-
sheraf.batches.checks.
print_health
(*args, model_checks=None, instance_checks=None, attribute_checks=None, other_checks=None)¶ Takes some modules in parameters (e.g. “american.class.cowboy_module”).
The function will discover models in the modules, analyze every model instance, and return a health report in a human readable format. Depending on the result, you may need to apply some migrations.
This function does not edit any data and is safe to be executed in a production shell.