Skip to content
Discussion options

You must be logged in to vote

this means you have either an append event listener or a @validates listener on a collection, and the code within that handler is causing the collection to be loaded, when it is not expected to be loaded.

the main purpose of append /validates events are to work upon the value that is being appended, not the collection itself. so best strategy is, inside that event handler, don't touch the collection itself, if possible.

otherwise, the assertion here likely means the event is being triggered by a backref. the example below shows how to reproduce this issue and also how to work around it by only accessing the collection if this is the primary event and not the backref event.

from sqlalchemy i…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@io7m
Comment options

@io7m
Comment options

@zzzeek
Comment options

@io7m
Comment options

@zzzeek
Comment options

Answer selected by io7m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants