SichangHe / internet_route_verification_server

[ABANDONED] Network-operator-facing web server for `internet_route_verification`
MIT License
0 stars 0 forks source link

DB design #2

Open SichangHe opened 1 year ago

SichangHe commented 1 year ago

@drowninwater, does this look right compared to the hand-drawn diagram I showed you today:

https://github.com/SichangHe/internet_route_verification_server/blob/main/db_design.md

@cunha, I've looked it up: modeling Rust enums in SQL would just be the same as doing inheritance (i.e., one table per variant). None of the ORMs I found support enums with associated values; they just store strings/ints. Also, these ORMs themselves are big learning curves. So, I lean towards rawdogging SQL.

SichangHe commented 1 year ago

How about this: I write to the DB from Rust with SQL, @drowninwater reads from the DB within the web server in Python with SQL.

cunha commented 1 year ago

I don't think any of these are blocking, but it may be worth trying to ease at least one of the directions. I don't have experience with Rust ORMs, but the Python ones allow devs to write classes with typed fields (e.g., using Pydantic). Then the ORM handles creation of the DB schema, loading, and saving of entities. So an idea is to create the classes in Python, get the DB schema from the Python ORM, and then dump to that schema in the Rust code. (Hopefully the Python ORM won't create a schema that is a huge mess.)