absent1706 / sqlalchemy-mixins

Active Record, Django-like queries, nested eager load and beauty __repr__ for SQLAlchemy
MIT License
756 stars 67 forks source link

Why does the TimestampsMixin not enable timezones? #112

Closed jonbiemond closed 1 year ago

jonbiemond commented 1 year ago

I'm curious as to why the TimestampsMixin explicitly disable timezones in the TIMESTAMP fields. https://github.com/absent1706/sqlalchemy-mixins/blob/d1475a58d9f5b27dd7a794d7c3acb496aad6fd29/sqlalchemy_mixins/timestamp.py#L14

Looking at the relevant commit message it seems like @metheoryt meant to enable them.

Is there any reason to have timezones disabled on those fields?

metheoryt commented 1 year ago

Hi @jonbiemond ! As I remember, it didn’t seem useful to me to have a timezone at those columns at that moment. Since the columns aren’t meant to be updated by end users, there is no point to store a timezone here. If you need to display that data in a timezone-aware approach, it is better to convert it to desired timezone at displaying time.

However, it is a general rule and might not apply for your case. If you need timezone aware timestamps for those fields, I could suggest you to add them manually.

jonbiemond commented 1 year ago

Hello!

Yes, that makes perfect sense. Thank you! I appreciate the suggestion.