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 …
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!
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?
Anti Commercial-AI license
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