3da250d7a35bc12da4772983f3791fa23242a9e0

SQLAlchemy's handling of time is stupid. If you hand it a datetime with an explicit time zone set, and attempt to put it in a "timestamp without time zone" field, it will convert it to your local time first. This is probably not what you want! Especially in ArrowType case, because when you retrieve the value and pass it to arrow.get, arrow assumes the time is in UTC, when it's really in local time. This leads to nonsense like this: myrecord.time = time db.session.commit() myrecord.time != time # wtf! It changed! In this commit, I make the assumption that you always want to put UTC timestamps into your database, so I convert the incoming time to UTC and then discard the time zone so SQLAlchemy wont mess with it. A future version of this type might allow you to specify what time zone you want to assume this database column actually represents, so you can convert to and from that time zone when saving and retrieving.
SQLAlchemy-Utils
Various utility functions, new data types and helpers for SQLAlchemy.
Resources
Description
Languages
Python
99.9%