Relative Content

Tag Archive for pythonsqlmodel

Why does `timezone` not work in `sqlmodel`?

I’m using sqlmodel to do sql-orm. I learned from this page and this page, but both failed, the time inserted into the table is anyway utc time, no matter I set timezone True or False. At last I need to set cur_time: str = Field(default=datetime.now().strftime("%Y-%m-%d %H:%M:%S")) then everything goes well. But I’m just confused why I can’t insert local time with Columns(DateTime(timezone=True))