-
Notifications
You must be signed in to change notification settings - Fork 29
Many to Many relationship #54
Comments
Hi Carlos, There are multiple ways to achieve this:
[*] If you go with solution 1 and want to ensure that the ids exist on the other side, you can write a Processor that checks that the ids being passed in the requests exist in the database. |
Many to many relationship can be often necessary - in many systems there is no other choice. We were investigating current options with Ramses (optionally with nefertari) and did not succeed yet. In the popular example The Pizza Factory there is a relation between a pizza recipe and a cheese, which seem to be as many to many. Evaluating the example we did not succeed making it running (even trying older versions of all related databases), anyway, it seems like the schema for a cheese contains a field linking to a pizza what is rather surprising. So even this did not served as example of possible solution. As we really need to resolve the many to many (a user can have membership in multiple teams), we are trying to clarify current options:
As this ticket is still open, I assume, ramses is not yet ready for junction tables. The question is: is nefertari (and nefertari_sqla) able to support junction tables? |
hey @vlcinsky: You might want to look at the #1 solution described in my original answer. This would be my preferred solution if I had to do this. I would use a Processor or an asynchronous worker to clean-up stale relationships. |
I wonder what is the meaning of:
Does it mean, that the underlying features (like |
I've been creating a project using ramses (SQLAlchemy as the backend engine) by following the example project - https://github.com/brandicted/ramses-example - and the tutorial published on realpython.com - https://realpython.com/blog/python/create-a-rest-api-in-minutes-with-pyramid-and-ramses - although I'm stuck with something I see as a simple problem: I've been able to define one to may relationships using the schemas, but I haven't managed to do the same for many to many relationships. Is it possible to define many to many relationships using the schemas in ramses?
I've you've like to check the schemas I want to be related, here they are: https://github.com/Shemahmforash/ThisDayInMusicAPI/blob/develop/thisdayinmusic/schemas/tracks.json and https://github.com/Shemahmforash/ThisDayInMusicAPI/blob/develop/thisdayinmusic/schemas/playlists.json
Thanks a lot for your help.
The text was updated successfully, but these errors were encountered: