Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch Metric-Resource relationship to back_populates
Replace usage of the deprecated backref option [1] and implicit relationship population, with the new back_populates [2] option and explicit relationship definitions on both the Metric and Resource classes. This eliminates "AttributeError: type object 'Metric' has no attribute 'resource'" exceptions that can occur when Metric.resource is referenced using sqlalchemy.orm.joinedload in queries. This change is backwards compatible with SQLAlchemy 1.4. 1: https://docs.sqlalchemy.org/en/20/orm/backref.html 2: https://docs.sqlalchemy.org/en/20/orm/basic_relationships.html
- Loading branch information