more relation/collection state confusion when using session.flush([only_one_of_the_objects]). time to deprecate ?

Issue #1315 resolved
Former user created an issue

Testcase is in the attachment. I'll be glad to help if you point me.


Angri

Comments (4)

  1. Mike Bayer repo owner

    I'm considering as a solution here to remove the flush([objects](objects)) feature in 0.6. There should be no use case for it.

  2. Mike Bayer repo owner

    1d3185139a923fa1a1998d4498748d8f49278ac0 allows you to properly reset the state of parent.children:

    session.flush([child](child))
    session.expire(parent, ['children']('children'))
    
    assert parent.children == [child](child), "%r != %r" % (parent.children, [child](child))
    

    but seriously, try to not use flush([obj](obj)). it makes no sense to use it on a single object in the midst of an interconnected graph of dependencies.

  3. Log in to comment