no-select-from-fix

This commit is contained in:
Untone 2024-02-22 23:13:29 +03:00
parent 96b698f7ff
commit f8dafda86b

View File

@ -98,19 +98,17 @@ def query_follows(user_id: str):
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, author_model=aliased_author)
topics_query = add_topic_stat_columns(topics_query) topics_query = add_topic_stat_columns(topics_query)
authors = [ authors = [
{ {