Need to add the tables to the .select() to prevent N+1, not merely to the join

This commit is contained in:
Joseph Schorr 2015-05-07 16:59:13 -04:00
parent 2105ad90a0
commit 729249f42b

View file

@ -2828,7 +2828,7 @@ def unstar_repository(user, repository):
def get_user_starred_repositories(user, limit=None, page=None):
""" Retrieves all of the repositories a user has starred. """
query = (Repository
.select()
.select(Repository, User, Visibility)
.join(Star)
.switch(Repository)
.join(User)