Re: [sqlalchemy] DRYing up model relationships with custom properties

2023-05-03 Thread 'Tony Cosentini' via sqlalchemy
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

Re: [sqlalchemy] DRYing up model relationships with custom properties

2023-05-03 Thread Mike Bayer
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: