Hi,

This might be a noob question, but I am trying to reproduce the
following sql query in SA

select user_id, friend_id from follows  where friend_id not (in select
id from users);

First, I do this:
subquery = Session.query(User.id).subquery()

Then
q = follows_table.select().where(not_(follows_table.c.friend_id.in_
(subquery)))

q turns into:
SELECT follows.user_id, follows.friend_id
FROM follows, (SELECT users.id AS id
FROM users) AS anon_1
WHERE follows.friend_id NOT IN SELECT users.id
FROM users


I'm not really sure where the first subselect comes from. Also, it
isn't a valid query in postgres because the second SELECT users.id
FROM users needs to be in parens.

Am I missing something?

Thanks,
Mike
--~--~---------~--~----~------------~-------~--~----~
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