I\'m trying to use SQLAlchemy on my python app but I have a problem with the many to many relationship. I have 4 tables:
users, flags, commandes, channels, and commandes
back_populates
needs to match the exact name of the related property on the other model. In Channel
, you have back_populates="channels"
, but in Commande
, you have:
channel = relationship("Channel", secondary="commandes_channels_flags", back_populates="commandes")
Instead, change channel = relationship
to channels = relationship
.
You'll also need to change the other relationship properties to Flag.commandes
, Flag.channels
, Channel.commandes
, Channel.flags
, and Commande.flags
to match your back_populates
arguments.