admin管理员组文章数量:1123101
There is a class that acts as a repository, and it has a .summary_rewards method, so, on my local machine it returns one data, and on my server it returns completely different data when I use this method. The timestamp data in the table is naive, the input data for searching is also naive. The time zone in the database settings is UTC. The isolation level is read committed.
What could be wrong? The server and my local machine have absolutely identical copies of my application.
class ReferalEntityRewardsRepository(SQLAlchemyRepository):
model = ReferalEntityReward
async def summary_rewards(self, start_dt: datetime, end_dt: datetime, currency: str = 'rub', **filter_by):
currency_map = {
'rub': self.model.amount,
'usd': self.model.amount_usd
}
stmt = (
select(func.count(self.model.id).label("total_rewards"), func.sum(currency_map[currency]).label("total_amount"))
.filter_by(**filter_by)
.filter(self.model.add_dt.between(start_dt, end_dt))
)
result = await self.session.execute(stmt)
total_rewards, total_amount = result.all()[0]
return total_rewards, total_amount
本文标签: sqlI get incorrect data when I use betweenStack Overflow
版权声明:本文标题:sql - I get incorrect data when I use .between - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736547866a1944472.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论