From a877e1a7b89ae55d178ab5634e5f3be453cf1ba0 Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 22 Feb 2024 23:07:08 +0300 Subject: [PATCH] select-from-fix --- resolvers/follower.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resolvers/follower.py b/resolvers/follower.py index 0d57fc14..0ccee9b7 100644 --- a/resolvers/follower.py +++ b/resolvers/follower.py @@ -95,17 +95,21 @@ def query_follows(user_id: str): if isinstance(author, Author): author_id = author.id aliased_author = aliased(Author) + authors_query = ( session.query(aliased_author, AuthorFollower) + .select_from(aliased_author) # явное указание FROM-запроса .join(AuthorFollower, AuthorFollower.follower == author_id) .filter(AuthorFollower.author == aliased_author.id) ) topics_query = ( session.query(Topic, TopicFollower) + .select_from(Topic) # явное указание FROM-запроса .join(TopicFollower, TopicFollower.follower == author_id) .filter(TopicFollower.topic == Topic.id) ) + authors_query = add_author_stat_columns(authors_query) topics_query = add_topic_stat_columns(topics_query) authors = [