[sqlalchemy] Automatically Adding M2M on append causing UNIQUE constraint violation

2014-08-06 Thread Cody Scott
I have an intermediate model which I am using to keep track of which labs to include since individual labs can be removed. So when you add a new intermediate model (AgendaModel) it automatically adds all of the labs. with @event.listens_for(Agenda.modules, 'append') But there is a UNIQUE

Re: [sqlalchemy] Automatically Adding M2M on append causing UNIQUE constraint violation

2014-08-06 Thread Michael Bayer
it seems apparent that the code is in some way appending the same Lab item to the AgendaModule.labs list twice. I'd tune that code, or just use collection_class=set so that dupes are eliminated as they are added. On Aug 6, 2014, at 1:38 PM, Cody Scott cody.j.b.sc...@gmail.com wrote: I have