On 04/11/2017 02:37 AM, shrey.chau...@invicto.in wrote:
Yes Mike will do that, mostly its marshmallow model schema which is
creating the object, as I am using Flask + marshmallow for APIs,


p.groups=[]         //when i try to empty it, i get this exception
*AssertionError: Collection was loaded during event handling.
                         *//though the action is getting performed,
putting a try catch is solving it, but why is it coming?


that error happens means there is an append() or remove() event handler, or alternatively a @validates hook for that attribute (which is the same thing), which is running probably in the context of a backref being set; when the backref is being set, p.groups is not yet loaded. when the handler runs, it is doing something that is causing p.groups to be lazy-loaded from the database, rather than just operating upon the incoming values. this is confusing the attribute system with state it doesn't expect. as always, stack trace will tell a lot more here.



though,
g.packages=[]    this is working fine with no exception



Thanks for any kind of help, in advance

--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and
Verifiable Example. See http://stackoverflow.com/help/mcve for a full
description.
---
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to sqlalchemy+unsubscr...@googlegroups.com
<mailto:sqlalchemy+unsubscr...@googlegroups.com>.
To post to this group, send email to sqlalchemy@googlegroups.com
<mailto:sqlalchemy@googlegroups.com>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to