getResultValues on a measurement-type SQLite ODM2 database is now returning ValueDateTime types as strings rather than datetime.
This was not the case last November, when the same code with the same database returned datetime types. In this notebook from the BiGCZ workshop in early-mid November 2017, the SQLite database is examined extensively. The time series plots in cells 24 and 26 correctly show valuedatetime as a datetime. Running that code today with a conda environment created back then, with odm2api 0.6.0a (created May 2017), also produces the expected type. But running it with the current odm2api release (0.7.1) returns a unicode-string-type valuedatetime.
getResultValues
on a measurement-type SQLite ODM2 database is now returning ValueDateTime types as strings rather than datetime.This was not the case last November, when the same code with the same database returned datetime types. In this notebook from the BiGCZ workshop in early-mid November 2017, the SQLite database is examined extensively. The time series plots in cells 24 and 26 correctly show
valuedatetime
as a datetime. Running that code today with a conda environment created back then, with odm2api 0.6.0a (created May 2017), also produces the expected type. But running it with the currentodm2api
release (0.7.1) returns a unicode-string-typevaluedatetime
.I've traced back changes that could have led to this regression (and bug). I think I've found it in this commit from 2017-11-13 ("update tests, update DateTime data type to be compatible with sqlite", merged in PR #122), in its changes to models.py. Specifically: https://github.com/ODM2/ODM2PythonAPI/commit/8a8ffe7d795cab657798c7149c9d4355e5c47bb5#diff-0ee3d0270e8061c9eb0e712c2e83d27aR18 and https://github.com/ODM2/ODM2PythonAPI/commit/8a8ffe7d795cab657798c7149c9d4355e5c47bb5#diff-0ee3d0270e8061c9eb0e712c2e83d27aR1658 (as well as all other
ResultValues
classes)I'm hoping the fix will be simple, involving changing https://github.com/ODM2/ODM2PythonAPI/blob/master/odm2api/models.py#L17 from
to
But I haven't tested it yet.