teknik-eksjo / chronos

A scheduling app that helps teachers submit workday outlines
MIT License
5 stars 5 forks source link

Data types for date and time #78

Closed Limpan closed 8 years ago

Limpan commented 8 years ago

Since the built-in datetime-library (https://docs.python.org/3.5/library/datetime.html#) isn't that great the need arises to discuss what data types should be used in the model. As it is the built-ins are used (datetime.date, datetime.time).

The Arrow library is a lot better (http://crsmithdev.com/arrow/) but at the moment I am unsure as how to best integrate it with SQLAlchemy. As I see it there's a few alternatives.

  1. Stick to the built-in datetime-based types. This already works but the datetime.date and datetime.time types are crappy when performing calculations.
  2. Use SQLalchemy_utils and the ArrowType data type. This will create a less obvious model where both Date and Time becomes ArrowType.
  3. Replace the date and time attributes on the fly. Sounds like a bad hack. Will probably create a lot of issues but allows us to keep two distinct data types for date and time.

Leaning towards 2

Greenheart commented 8 years ago

Arrow doesn't seem to have official support for py3.5 according to it's frontpage.

  1. Stick to the built-in datetime-based types. This already works but the datetime.date and datetime.time types are crappy when performing calculations.

Could allow us to get started fast?

Limpan commented 8 years ago

Yes. Things can always be improved on later.