Will commonly see examples of SQLAlchemy or SQLModel Bases that look like:
class DB1Base(SQLModel, registry=registry()):
There are x10^256 examples of this. And so lets take a step backwards and appreciate the prolific nature of
the guy in charge of random database object names
sqlalchemy docs screams to apply a database object naming convention.
alembic docs has a whole section dedicated it.
So what about SQLModel docs or issues? … (crickets)
Every example ever lacks applying naming convention to the registry metadata!
from sqlalchemy import MetaData
from sqlalchemy.orm import registry
# copy+paste from the sqlalchemy docs. One case don't wanna be creative.
naming_convention_no_schema = {
"ix": "ix_%(column_0_label)s",
"uq": "uq_%(table_name)s_%(column_0_name)s",
"ck": "ck_%(table_name)s_`%(constraint_name)s`",
"fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s",
"pk": "pk_%(table_name)s",
}
metadata = MetaData(
naming_convention=naming_convention_no_schema,
schema=schema,
)
reg = registry(metadata=metadata)
class DB1Base(SQLModel, registry=reg):
Why not to – job security!
Can only imagine that folks wanting to give every single database object a name manually would do that as a form of job security. If that is the case then carry on.
For those of us who don’t want to micro manage the micro manage of micro managers, would highly suggest not manually explicitly naming each and every database object. In each and every database. Not ever, but almost nearly ever.
For example, what if the guy in charge of random database object names gets a girlfriend? It could happen and what a disaster that would be. For him, for her, and for all the people who have to try to track down why a foreign key or unique constraint doesn’t exist when it’s clear as day in the code that it should be there.
Might have exaggerated, there is no agency of random database object names. But that won’t stop the guy in charge of random database object names. Numerically, he can snap his fingers and poof, that agency will exist. Don’t underestimate the power and unflinching resolve of the guy in charge of random database object names
The take away
Every single SQLModel Base ever neglects, when creating a registry, to apply database objects naming convention. This includes the SQLModel source code.
So why not submit a PR? SQLModel seems to be unmaintained. There are 69 PRs in the pipeline. So the options are:
-
wait for hell to start selling ice cream
-
poke fun at it
Only have enough coin for the boat man. So that leaves …
Bro, chill out. Just because someone missed something doesn’t mean you have to lose your mind about it. Your comment could’ve been a helpful one that provides a solution and explains (in a calm and polite manner) why it could be better than what’s proposed. Additionally, instead of complaining loudly about missing documentation and writing up a storm about it, why not contribute documentation?
Just because someone doesn’t know something you don’t, doesn’t make them an idiot. You need to learn about humility.
Nowhere was the term, idiot, uttered. It’s not an issue IQ solves. If it’s possible to just submit more PRs harder this situation would only worsen. No matter how many PRs or how well intentioned.
nuance is lost cuz the details keep piling up and its overwhelming. Have mercy! Provide a checklist. At the end of the checklist write This is everything you must do. There is nothing more. You are done!
You need to learn about humility
One more thing to add to the checklist. Is that sqlalchemy create_engine params, pass through dbapi drivers params, or sqlite peculiarities humility? And ask yourself if you want to be constantly thinking if only i was more humble create_engine would always work as expected, without worries, or in this case, without reframing (the conversation).
Are you seeing my point, the guy who points others to the contributing page?
The guy in charge of random database objects names does not harbor ill-intent, the heat he is packing in his pants is sufficient, he is in no way inadequate, in one way or another.
He’s overwhelmed. And along the way, nuance is lost.
The guy in charge of random database objects names is legion. And if not him, someone and something else.
Hmmm seem to have misplaced that checklist, it’s gotta be around here somewhere.
This isn’t even close to chill, dude. Wow. If you think that tone is going to help, I’m not sure what going through your head. Would you welcome or be convinced by somebody writing like that in your open source project?
If only would be so lucky. Truly i don’t mind. Here go at
Purposefully do not have any code of conduct for any of my packages. And i have not joined python.org to avoid submitting to a code of conduct.
Everyone is welcome to be themselves. If something hurtful is said, i’ll take it in stride without barraging the commenter with
Captain obvious
sweet nothings.You troll, i disparage. It’s not so different. Except for the two fresh super hero creation stories.
For the love of cosplay and super hero conventions, for a moment could put down those tunnel vision goggles to acknowledge the well written prose. Or not, but that’s on you
btw my favorite super hero is the mustache guy from Deadpool. All time favorite.
Made a very convincing argument that what the super hero universes need is a guy with a thick mustache who just happened to show up for the interview with that stash.
That’s what’s been missing from every super hero team.
As far as i can tell the mustache guy seems like a good blook.
I hate good people with their good intentions, mustache guy didn’t have good intentions. He just happened to want the job. Which was good enough for Deadpool.
This is why i’m nominating the guy in charge of random database object names to the team.
btw this is not off topic, read the SQLModel docs! All the examples are about super heroes and their teams. None of which i recognize cuz there also seems to be the guy who misspells super heroes and teams names
Which sorta makes sense. Anyone who’d lower case all table names would probably not be above misspelling super heroes and teams names.
Is there anything more sinister than lower casing all table names? And then … get this … preventing changing the table naming algo by hiding the implementation within a metaclass. Leaving the only option, to hardcode each and every table name.