SQLAlchemy: records on association table are not correctly created (association object and proxy approach)
I’m working on a small cycling community project that uses Flask and SQLAlchemy, with MySQL as db. The ORM isn’t complex one, but I tried to give it some flexibility. Four tables in total, but at the core are three tables (for users, challenges and mileage), users and challenges tables are connected in many-to-many relationship to each other via association object instead of association table (I thought it will simplify the model, as I can use that object to store mileage-per-challenge for each user too, instead of having a fifth table). I’ll be attaching the full model at the end of the post, for ease of read.