SQLAlchemy generator does not handle unidirectional associations
Describe the bug
The SQLAlchemy generator transform unidirectional associations to bidirectional associations
To Reproduce
- Create any model with a unidirectional association
- Generate SQLAlchemy code
- The generated code transformed the unidirectional relation to a bidirectional one
Expected behavior
No back population nor inverse relation created for this association
Screenshots
Well, in "pure" SQL, navigability is not a factor and foreign keys are added to the class where it makes sense based on the cardinality. Should this be really different in SQLAlchemy?
We could update the generator to remove the relationship (last line in the code above) when the navigability is False. This would keep the Foreign Key in the Pet table, ensuring it’s still associated with a Person, but Pet wouldn’t be able to directly access Person. This is possible in SQLAlchemy
Closing it down as I think our current implementation may not be perfect but still acceptable given that we are targeting SQL. Navigability could be enforced more at the UI level.