Skip to content

Commit

Permalink
Use with_only_columns() to restrict SELECT.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ammon Smith committed May 17, 2018
1 parent 27e4495 commit 2248d23
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion statbot/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -1132,9 +1132,10 @@ def remove_old_members(self, trans, guild):
self.tb_guild_membership.c.guild_id == guild.id,
self.tb_guild_membership.c.is_member == True,
))
sel = sel.with_only_columns([self.tb_guild_membership.c.user_id])
result = trans.execute(sel)

for user_id, _, _, _, _ in result.fetchall():
for user_id, in result.fetchall():
member = guild.get_member(user_id)
if member is None:
self.remove_member(trans, user_id, guild.id)
Expand Down

0 comments on commit 2248d23

Please sign in to comment.