▲ | sgarland 4 days ago | |||||||||||||||||||||||||
> Loading stuff from db, you need validation again, either go from binary response to 1 validated type with pydantic, or ORM object that already validates. You shouldn’t need to validate data coming from the database. IMO, this is a natural consequence of teams abandoning traditional RDBMS best practices like normalization and constraints in favor of heavy denormalization, and strings for everything. If you strictly follow 3NF (or higher, when necessary), it is literally impossible to have referential integrity violations. There may be some other edge cases that can be difficult to enforce, but a huge variety of data bugs simply don’t exist if you don’t treat the RDBMS as a dumb KV store. | ||||||||||||||||||||||||||
▲ | vjerancrnjak 4 days ago | parent [-] | |||||||||||||||||||||||||
Depends. If you do a query that computes something, the output columns have data types that you’d like to validate. Checking that you receive an int, string or enum is unavoidable. Even a JOIN might surprise you with null values. | ||||||||||||||||||||||||||
|