On 3/6/07, Andrea Gavana <[EMAIL PROTECTED]> wrote: > t = self.session.query(TreeNode).select(TreeNode.c.name=="MyName", > order_by=[TreeNode.c.id]) > > But this line always returns an empty list. In order to get what I > want, I need to do: > > query = self.session.query(TreeNode) > count = query.count() > for ii in xrange(1, count+1): > parentnode = query.get(ii) > if parentnode.name == "My Name": > break
it sounds like you inserted a bunch of new objects, but didn't flush, so select() doesn't see them. get() does see it because it checks the identity map before querying the db. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
