Re:Databases always have a schema (2018)
by threeseed on Monday February 25, 2019 @05:30PM
(#19250101)
For many use cases we don't know the schema up front.
So it's irrelevant whether it exists or not because we don't know it.
Re:Databases always have a schema (2018)
by ben509 on Wednesday February 27, 2019 @07:07PM
(#19268025)
That's a great point, but I think the real issue there is that typical SQL DBMS's make it very hard to adjust the schema iteratively as you code. After all, if you're writing in a language like Java, you don't know what your classes look like to start with, but coders manage that by adjusting and refactoring them as they work.
If I write some code to sum up account balances, it's going to expect a series of account objects, and they need to have some `.balance` field.
And those fields need to be decimals, because addition will choke if they're not.
Your code implicitly defines a schema, and it's utterly rigid because it will crash if the data structure is incorrect.
Or worse.
Imagine if some of the "balances" are actually some irrelevant field that happens to be a number, or some are missing because some of the JSON misspelled the field name and you skipped those records. Now the result you're processing is silently wrong, and who knows how far the corrupt data gets before someone catches it?
All schemas are enforced rigidly because that's how computers work. The difference is whether you want the DBMS to nag you while you're coding, or whether you'd rather be woken in the middle of the night by an angry customer or boss.