Just to follow up on what I ended up doing - I went with approach 1 and
created a function that would add it. I also switched from __ to _ to avoid
any surprises.
Thanks again for the suggestions!
On Wednesday, May 3, 2023 at 9:27:57 PM UTC+8 Mike Bayer wrote:
> I'd be a little concerned about
I'd be a little concerned about the double-underscore as it modifies the way
Python getattr() works for those names, and I dont know that we have tests for
that specific part of it, but besides that, you can always add new
relationships or other mapped attributes to classes in one of two ways:
Hi,
I have a pattern in some models where there is a private (as in prefixed
with __) relationship and then a property to handle some things that need
to happen when the relationship is fetched or written to.
Currently it's implemented like this:
class ModelClass(Base):
__field_for_relationsh