Skip to content

Datamodel/SQLAlchemy improvements

schmidni requested to merge feature/sqlalchemy into develop

As I was going through the whole datamodel in order to create a diagram, I improved/corrected some datamodel definitions.

Mostly the following points were fixed throughout the datamodel:

  • The primary key id field does not have to be separately defined when inheriting from ORMBase.
  • Fixed a couple of delete cascade definitions.
  • uselist=True does not need to be specified in a normal one-to-many relationship.
  • single_parent=True does not need to be specified in a normal one-to-many relationship.
  • RealQuantity is by default optional, removed the optional=True statements.

One point I'm not 100% sure about are the DeleteMultiParentOrphan definitions I removed from the InjectionWell/HydraulicSample. Afai understand it, we don't have wells/sections which at the same time contain the observed hydraulics and an injection plan. Therefore, we don't need to use the multiparent solution and should be fine with the delete cascades as introduced lately. Please correct me if I'm wrong. If at some point we need to (re-)implement the DeleteMultiParentOrphan solution somewhere, then the respective cascade definitions need to be changed.

Merge request reports

Loading