On Wednesday, February 5, 2020 at 5:58:30 PM UTC-5, Mike Bayer wrote:
>
> OK so you are explicitly worrying about a one-to-many relationship that 
> should be one-to-one, or vice versa, that is, you aren't worried about FKs 
> or remote_side setting up the entirely wrong M2O / O2M for a relationship.
>

Exactly!

 

> However luckily, the only issue with any of this is having that argument 
> available and fortunately it looks like I got around to adding info to 
> relationship(), so you can check  / validate whatever you want, including 
> if the "direction" got set up as expected or whatever other things you want 
> to put into that info.  here's o2o:
>

Awesome!  Thanks you so much, Mike! 

I had a feeling there was some way to leverage sqlalchemy's existing API 
and hooks/events to do this!  I just couldn't figure it out myself!

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/15f56121-b15d-4e1c-ac8f-c2731b009ecb%40googlegroups.com.

Reply via email to