So is this likely a sqlalchemy bug? Should I just dig in a look into why the
delete is not finding the bind where the select is?
FWIW, here's a ref to delete+where:
http://dev.mysql.com/doc/refman/5.0/en/delete.html

2009/9/16 Orca <trueo...@gmail.com>

>
> you have to use Session.execute with explicit mapper defined, for some
> reason session.query.delete/update is not detecting any bindables in
> statement as it does for select-queries.
> if your TreeNode Table defined as Tree_Node_Table:
>
> Session.execute(Tree_Node_Table.delete(Tree_Node_Table.c.guid.in_
> (deadNodeGuids)), mapper = TreeNode)
>
> Not sure about 'where'-clause for 'delete' method.
>
>
> On 15 сен, 21:41, "jeff.enderw...@gmail.com"
> <jeff.enderw...@gmail.com> wrote:
> > I'm trying to delete in bulk using query().  query() seems to work
> > fine:
> >
> > (Pdb) Session.query(TreeNode).filter(TreeNode.guid.in_
> > (deadNodeGuids)).all()
> > [<lajolla.main.tree.TreeNode object at 0x81c82c8c>,
> > <lajolla.main.tree.TreeNode object at 0x81c8220c>]
> >
> > But delete() is not happy:
> >
> > (Pdb) Session.query(TreeNode).filter(TreeNode.guid.in_
> > (deadNodeGuids)).delete()
> > *** UnboundExecutionError: Could not locate a bind configured on SQL
> > expression or this Session
> >
> > I'm using 0.55, 'binds' (more than one engine), and scoped_session.
> > Any idea why the binds would 'stick' for the read query but not the
> > delete? Here's the binds:
> >
> > Session.configure(binds={User:engineAccounts, TreeRoot:engineTrees,
> > TreeNode:engineTrees, Content:engineTrees})
> >
> > TIA,
> > Jeff
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to