Это старая версия документа!
Python - Документация
Логика
(VotingAchievement.uuid == nomination_id) if nomination_id else True ~ VotingAchievement.uuid
Alchemy
nominations = await self._session.execute( select(VotingAchievement).where( ~VotingAchievement.is_deleted, VotingAchievement.is_published, (VotingAchievement.uuid == nomination_id) if nomination_id else True, ).order_by(VotingAchievement.position).options( selectinload(VotingAchievement.icon), selectinload(VotingAchievement.preview) ) ) for nomination in nominations.scalars().all(): ...
result = [] for nomination in nominations.scalars().all(): query = select( ExponentVotesAggregation.uuid, ExponentVotesAggregation.title_ru, ExponentVotesAggregation.title_en, func.sum(ExponentVotesAggregation.count).label("count") ).where( ExponentVotesAggregation.created_at >= since, ExponentVotesAggregation.created_at <= till, ExponentVotesAggregation.nomination_id == nomination.uuid, ).group_by( ExponentVotesAggregation.uuid, ExponentVotesAggregation.title_ru, ExponentVotesAggregation.title_en, ).order_by(desc(text("count"))) exponents = await self._session.execute( query ) result.append((nomination, exponents.all(),))
Ссылки
2024/04/05 15:44 | linkbacks Linkbacks | python, alembic | ||
2024/05/20 12:34 | linkbacks Linkbacks | languages, python, book, pip, python-setuptools, easy install | ||
2024/05/26 22:49 | linkbacks Linkbacks | languages, python, book, pip, python-setuptools, easy install | ||
2015/10/13 09:01 | linkbacks Linkbacks | languages, python, book, pip, python-setuptools, easy install | ||
2024/05/26 22:53 | linkbacks Linkbacks | languages, python, book, pip, python-setuptools, easy install | ||
2024/05/01 11:14 | linkbacks Linkbacks | languages, python, book, pip, python-setuptools, easy install, smtplib, email | ||
2016/01/31 14:41 | linkbacks Linkbacks | languages, python, book, pip, python-setuptools, easy install, smtplib, email | ||
2015/11/26 23:14 | linkbacks Linkbacks | service, unix, linux, python, supervisor, initd |