First of all, the point of the question is to calculate daily statistics based on DB data You are about to import it.
I'm trying to implement it through the ORM query statement method, but the logic is not well implemented, so I'd like to ask you a question.
In the DB,
Y-m-d H:M:S (2021-05-13 12:11:10) is saved through
While looking for an implementation method, we have considered using the
>= operator or
<=, but this makes it impossible to count the exact date of the day, so I wonder how to get the number of data for that day in a daily statistic.
I don't know if it'll help... If it's raw, for example, MySQL, it's handled in this way.
The key is to convert datetime-type data to the 'date' level and use it for grouping and aggregation. There must be several ways to handle this in SQLAlchemy. If you understand the basic concept, try it.
© 2022 pinfo. All rights reserved.