From c7fe7f458cbae9cc858939a64ba6d75379b6e404 Mon Sep 17 00:00:00 2001 From: Untone Date: Sun, 25 Feb 2024 19:44:33 +0300 Subject: [PATCH] aliased-author-fix --- resolvers/author.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resolvers/author.py b/resolvers/author.py index fcba7c00..bd553458 100644 --- a/resolvers/author.py +++ b/resolvers/author.py @@ -44,9 +44,10 @@ async def get_author(_, _info, slug='', author_id=None): try: if slug: with local_session() as session: - q = select(Author).filter(Author.slug == slug) + aliased_author = aliased(Author) + q = select(aliased_author).filter(Author.slug == slug) [author] = session.execute(q) - author_id = author.id + author_id = aliased_author.id if author_id: cache = await redis.execute('GET', f'id:{author_id}:author') if not cache: