select-from-fix
All checks were successful
Deploy to core / deploy (push) Successful in 1m44s

This commit is contained in:
Untone 2024-02-22 23:07:08 +03:00
parent 00b7aab220
commit a877e1a7b8

View File

@ -95,17 +95,21 @@ def query_follows(user_id: str):
if isinstance(author, Author): if isinstance(author, Author):
author_id = author.id author_id = author.id
aliased_author = aliased(Author) aliased_author = aliased(Author)
authors_query = ( authors_query = (
session.query(aliased_author, AuthorFollower) session.query(aliased_author, AuthorFollower)
.select_from(aliased_author) # явное указание FROM-запроса
.join(AuthorFollower, AuthorFollower.follower == author_id) .join(AuthorFollower, AuthorFollower.follower == author_id)
.filter(AuthorFollower.author == aliased_author.id) .filter(AuthorFollower.author == aliased_author.id)
) )
topics_query = ( topics_query = (
session.query(Topic, TopicFollower) session.query(Topic, TopicFollower)
.select_from(Topic) # явное указание FROM-запроса
.join(TopicFollower, TopicFollower.follower == author_id) .join(TopicFollower, TopicFollower.follower == author_id)
.filter(TopicFollower.topic == Topic.id) .filter(TopicFollower.topic == Topic.id)
) )
authors_query = add_author_stat_columns(authors_query) authors_query = add_author_stat_columns(authors_query)
topics_query = add_topic_stat_columns(topics_query) topics_query = add_topic_stat_columns(topics_query)
authors = [ authors = [