Skip to content

Instantly share code, notes, and snippets.

@rclark72
Last active December 26, 2015 19:39
Show Gist options
  • Save rclark72/7202592 to your computer and use it in GitHub Desktop.
Save rclark72/7202592 to your computer and use it in GitHub Desktop.
right_alias = db.select([UserFollowing.user1_id, UserFollowing.user2_id]).alias()
left_alias = db.select([UserFollowing.user1_id, UserFollowing.user2_id]).alias()
joined_query = left_alias.join(right_alias, onclause=db.and_(right_alias.c.user1_id == left_alias.c.user2_id, right_alias.c.user2_id == left_alias.c.user1_id))
# StatementError: Not an executable clause (original cause: ArgumentError: Not an executable clause) '(SELECT user_users.user1_id AS user1_id, user_users.user2_id AS user2_id \nFROM user_users) AS anon_1 JOIN (SELECT user_users.user1_id AS user1_id, user_users.user2_id AS user2_id \nFROM user_users) AS anon_2 ON anon_2.user1_id = anon_1.user2_id AND anon_2.user2_id = anon_1.user1_id' []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment