As a curiosity, are there any orgs/projects out there that use natural keys for their #database instead of surrogate keys?

@divclassbutton - Yes. Do you really intend to start *that* religious war here?

OK, I'll play. Here's one take on it: https://splinterofthesingularity.blogspot.com/2011/05/

#Database #ReferentialIntegrity

Splinter of the Singularity

@rdnielsen I'm speccing something out at the moment and I'm sorely tempted to use them. I remember a lot of arguments about it in the past that seem to have disappeared... Guessing ORMs hide the DB enough that few need to care anymore. 😅

@divclassbutton - The appropriateness of #ORMs is a whole other argument. And part of that argument is management of primary keys and referential integrity, of course. I use #Django but not its ORM features because using declarative referential integrity in the database is more flexible and more robust.

#Database

@rdnielsen I don't use ORMs either, but for sillier reasons... I learned SQL before I learned python, so never bothered to learn SQLalchemy because Psycopg2 was all I ever needed. 😅

@divclassbutton - Another reason to eschew ORMs is that learning to use one #ORM is comparable to the effort required to learn #SQL, and then there's another ORM, and another, and another...

And SQL is still more powerful, after all that.

#Database

@divclassbutton @rdnielsen i used the sqlalchemy expressions api for a project about a decade ago. it turned out to be very useful when i had to extract the core code for another service and target mysql instead of postgresql.

most of my changes were related to "returning" -- mysql, at least at that time, didn't return the entire inserted row, just the id column. the rest of the code worked as is.
@rdnielsen this article is really good! Thanks for sharing!
@divclassbutton @rdnielsen ime the performance downsides are not worth it- if you are going to join on multiple keys multiple times you might as well just calculate a smaller hash and use that as your pk (or just use a synthetic key) because you are asking for 4 (or depending on your data type) hundreds of times wider keys to keep in memory and do work with