Hi all,

I'm trying to run a (non-ORM) query of the form:
  SELECT job_id, pathname FROM jobfilesTable WHERE (job_id, pathname)
NOT IN (SELECT job_id, pathname FROM tempTable)

After searching the docs and the mailing list, the best I've been able
to come up with is something like:

from sqlalchemy.sql.expression import _Grouping, ClauseList

s = select([jobfilesTable.c.job_id, jobfilesTable.c.pathname])
s2 = select([tempTable.c.job_id, tempTable.c.pathname])
colgroup = _Grouping(ClauseList(jobfilesTable.c.job_id,
jobfilesTable.c.pathname))
s = s.where(~colgroup.in_(s2))

It seems to generate the appropriate SQL, but I'd prefer not to have
to rely on _Grouping(), as it appears not to be part of the public
API.  Any suggestions for a more elegant way of doing this?

Thanks,
Matt Z.

P.S.  Creating the temporary table seen in select "s2" was a bear,
involving a manual string substitution on a Table.create() bound to an
Engine with strategy="mock" then feeding the result to the DB.  Are
there any plans for supporting temporary tables in SA?

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to