I experimented with the simplest option, anticipated in the question. Also anticipated by the db.Model designers, it would seem (i.e. easy to do!)
- How to do it
- Yes: simply change from date_filed=db.DateProperty to date_filed=db.DateTimeProperty
- Will it somehow update existing entities automatically?
- Kind of: Specifically
DateProperty.get_value_for_datastore
method actually converts anydatetime.date
object to adatetime.datetime
object before storing it as a "raw value" in the database. - Existing entities aren't really updated automatically, they just start using
DateTimeProperty.make_value_from_datastore
, (the opposite ofget_value_for_datastore
) which falls back toProperty.make_value_from_datastore
, which returns the raw value; thedatetime.datetime
object; not "truncating" it to adatetime.date
object - No need to : ...create a task to change them
- Kind of: Specifically
- If entities with have different types for same properties, how does filtering and ordering on that property work?
- Irrelevant in this case; they have the same underlying type.
- Although the "deterministic ordering based on internal representations" statement, which lists dates and datetimes both at the same bullet, suggests they have a common internal representation so they're comparable for ordering/filtering, etc.
- What are some outcomes / pitfalls
- None encountered in this case; maybe someone has stories of other datatype migrations/conversions?