Skip to content

Database Query to generate a Time-based Chart

I have a logins table in the following (simplified) structure: Now I want to generate chart like this: https://prnt.sc/mifz6y Basically I want to show the logins within the past 48 hours. My current query: This works as long as there are entries for every hour. However, if in some hour there were no logins, t…

SQLAlchemy how to group_by relation?

Here are the models: class User(Base): __tablename__ = ‘users’ id = Column(CHAR, primary_key=True) first_name = Column(CHAR) last_name = Column(CHAR) email = Column(CHAR) …