Skip to content

datetime UTC change broke PostgreSQL support #543

@nicfar1708

Description

@nicfar1708

Good morning,

with the recent upgrade to the monitoring dashboard to version 5.0 the datetime support has been updated, this has, however, broken my previous installation (using PostreSQL as backend) due to the way in which SQLAlchemy ORM works.

In the __init__.py within flask_monitoringdashboard.database the timestamps are defined in this way (let's take for example Request)

time_requested = Column(DateTime, default=datetime.datetime.now(datetime.timezone.utc))
    """Moment when the request was handled."""

the default timestamp however is evaluated once, when the module is loaded, so the timestamps stays frozen.
The solution would then be to update the functions that perform insert operations to explicitely calculate the current time every time that they are called.

Thank you for your help in this matter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions