I create a small (4 lines) patch for databases/postgres.py

def _append_from(self, text, stmt):
    return text.replace(' WHERE', ' FROM ' + string.join([table.name
for table in stmt.kwargs['postgres_from']], ', ') + ' WHERE')

def visit_update(self, update_stmt):
  text = super(PGCompiler, self).visit_update(update_stmt)
  if 'postgres_returning' in update_stmt.kwargs:
    text = self._append_returning(text, update_stmt)
  if 'postgres_from' in update_stmt.kwargs:
    text = self._append_from(text, update_stmt)
  return text

But I think that text.replace(...) is ugly, may be you know how to
insert FROM clause before WHERE without replacements?

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