They could also have done default=uuid.uuid4 to have a new id each time, or default=lambda : str(uuid.uuid4()). It's not really related to whether or not it's a database default.
It seems quite unfair to place the blame on SQLAlchemy here, or even Python.
Even a statically typed language wouldn't prevent this kind of issue - the author of the code is the only person who can decide when they mean "use this exact string each time" or "use this function to give me a new string each time".
I suppose a column description API could follow the dataclass style definition, with different argument names for default and default_func. That would (I think) prevent this from happening.
I've tried a bunch, but many of the prettier ones don't have Linux versions. I've been using DBeaver (https://dbeaver.io/) for years now though - it's occasionally a little rough around the edges, but overall it's really amazing!
It uses jdbc drivers for database support, so it can handle basically anything.
The author of SQLAlchemy (which recently released great async support) wrote a great post about how async can actually lead to a small decrease in performance compared to the older threading model, at least for db related functions in a web backend context. [1]
For websockets or lots of network calls, you can't really beat async though.
May I ask what context you use it in? It looks like it strikes the right balance between simplicity and descriptive power - kinda like a statically typed python.
The web side of it seems rather different from a Flask or FastAPI setup, and it obviously doesn't have SQLAlchemy (which I really like). Do you have any recommendations on that front?
Seveneves by Neal Stephenson. Excellently written like all his books, but the complete loss of hope (realistic as it was) was far too depressing - I like my SciFi as escapist as possible
I'm currently loving FastAPI and Sqlalchemy, but I have been looking for TypeScript equivalents - TS is such a nice language to work with.
What libraries are you using? I haven't found anything that seems to match the easy OpenAPI schema generation and validation that FastAPI and Pydantic provide.
My occasional accidental Google search for programming related things has been filled with spammy sites - I wouldn't quite describe them as "no content", but there really wasn't much of it. DDG isn't really better, but I definitely wouldn't say it's worse, at least for my searches.
I'm interested to hear how you find it - I looked at it to manage some parts of an already existing system (postgres + sqlalchemy) and there are some quirks.
It doesn't automatically detect foreign keys and make the fields for them correctly. Furthermore, it seems like they don't even use foreign keys for the models created through their UI - I checked the github issues, it seems like all of this is planned but work on it seems to have just started.
I don't mind this too much, to be honest, though I would prefer it if they open sourced it with licence based restrictions.
They're not open sourcing Pylance, which has some really nice features. The ones I mainly use are the semantic highlighting (it colours variables etc based on their type), and the auto imports (wow, I didn't realise how much I missed that).
However, those are just sugary extras, the real benefit is the typescript based type analysis. This can be had using the open sourced pyright extension.
This was posted in 2016, but their process hasn't changed. I'm not sure if it's actually caused any real damage yet (usually you'd add your domain fairly quickly), but it seems crazy that in between declaring DO as your DNS provider and importing the domain on DO, it can be stolen.