Closed ckoerber closed 5 years ago
With commit bed3fac833b6ee870ee161abc4cd38f782cce205 of EspressoDB (which will be in version 1.0.0), the check_consistency
method will be a class method. E.g., it has to be called like
@classmethod
def check_consistency(cls, data: Dict[str, Any]):
assert data["column1"] >= some_number
We should aim for this behavior.
You can also raise more verbose errors like
if data["column1"] < some_number:
raise ValueError("column 1 value is too small...")
The new EspressoDB checking behavior will inform the user which class raises which error with which values. So there is no need to append data to the error.
Done with commit f58c5621f90162f364a9ad4a57601d358e381383 and previous.
General thought
It would be nice if every time we (massively) populate a table, we ensure that we implement a method which checks internal consistency.
For example, all propagators used are based on the same gauge config.
I would propose that each table / class has a method called
which raises specific errors if the instance is not consistent. If we have that, we can make the base class call this method before inserting in the database.
ToDo
As a first use case, it would be nice if we could write this method for the
Baryon2pt
class.