gnthibault / RemoteObservatory

Astronomical observatory control system
https://gnthibault.github.io/RemoteObservatory/README.md
GNU General Public License v3.0
10 stars 3 forks source link

Create proper data model to interact with DB #49

Open gnthibault opened 1 year ago

gnthibault commented 1 year ago

Nice blog article about it: https://towardsdatascience.com/how-to-make-the-most-of-pydantic-aa374d5c12d

Use of pydantic ecosystem: https://docs.pydantic.dev/latest/usage/schema/ https://docs.pydantic.dev/latest/datamodel_code_generator/

Draw data model with: https://erdantic.drivendata.org/v0.2/examples/pydantic/

In particular, we expect to use from functools import singledispatch with @singledispatch and @process.register

Decorators, to save proper data object to the DB through SQLAlachemy, see a nice demo here: https://fastapi.tiangolo.com/tutorial/sql-databases/