r/FastAPI • u/pottymouth_dry • Dec 31 '24
Question Real example of many-to-many with additional fields
Hello everyone,
Over the past few months, I’ve been working on an application based on FastAPI. The first and most frustrating challenge I faced was creating a many-to-many relationship between models with an additional field. I couldn’t figure out how to handle it properly, so I ended up writing a messy piece of code that included an association table and a custom validator for serialization...
Is there a clear and well-structured example of how to implement a many-to-many relationship with additional fields? Something similar to how it’s handled in the Django framework would be ideal.
View all comments
Show parent comment
0
u/SilentCabinet2700 Jan 01 '25
Migrations can be easily enabled with alembic. But there's still no support for async indeed as far as I can tell.
I don't have enough information to state wether sqlmodel is a good fit for OP's use case or not. I just thought it's a very easy to follow example which could be useful.