Hello, I'm working with a class that creates more objects inside a transaction. The problem I encounter is that when I query the session, I get only what's stored already in the database and I don't match objects in session.new (which were just created). Is there any way of running the same filter I use for query on session.new objects (or any other way of retrieving the newly created objects that match my filter?)
class A(object): @classmethod def add_object(session): obj = A() a.counter = 0 previous_As = session.query(A).all() for previous_A in previous_As: previous_A.counter += 1 session.add(A) @classmethod def add_objects(cls, session, how_many): for i in range(0, how_many): cls.add_object(session) In the example, I would call A.add_objects(session, 5), and would expect, in the end, to have 5 objects with counters 4, 3, 2, 1, 0. Thank you, Andrei Chirila -- Mobile: +49 151 42647382 e-Mail: andre...@gmail.com -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.