Josh Stratton wrote: > > Maybe my setup isn't correct, but if I do something like this: > > session.add(myObj) > session.flush() > > # try adding to the database here > # check if it's in there > matches = [obj for obj in session.query(MyObj)] > > And matches is an empty list, can I assume something is seriously > wrong? Shouldn't this work even without the flush since the session > keeps track of it?
if the flush succeeds and that's a MyObj, then yes it should be coming back in the MyObj. There's a deprecated setting on mapper() called allow_null_pks=True. Since you're mapping to a join, if any of the values within the composite primary key of a particular row are NULL you'll want to set this to True. Its on by default in future versions of SQLA. not sure if this applies to your specific situation, though. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
