jic-dtool / dservercore

Given a dataset UUID returns a URI to where the dataset is stored
MIT License
4 stars 5 forks source link

For discussion: explicitly hold timestamps at as Float() in db? #38

Open jotelha opened 1 year ago

jotelha commented 1 year ago

Originally, sql_models.Dataset(db.Model) defines columns frozen_at and created_at as db.DateTime(), its method as_dict() converts those with dtoolcore.utils.timestamp(self.frozen_at). This, however, results in the autogenerated client API to expect a serialized datetime object and to throw an exception when receiving float. Treat created_at and frozen_at as floats in schema with https://github.com/jotelha/dtool-lookup-server/blob/9d1b8cc751f1d1e143bae10d9454d86be438dc13/dtool_lookup_server/sql_models.py#L122-L128 as suggested below https://marshmallow.readthedocs.io/en/latest/quickstart.html#implicit-field-creation.

Not sure whether this issue would still persist, a lot has changed on the code since first encountered in https://github.com/jic-dtool/dtool-lookup-server/pull/24.

tjelvar-olsson commented 1 year ago

Not sure about this. I think it is a datetime in the SQL DB to potentially do clever filtering.