Hacker Newsnew | past | comments | ask | show | jobs | submit | Lunrtick's commentslogin

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 could imagine some sort of static analysis saying that using a constant value instead of a function is a mistake for columns with unique set.


That's a good point! I suppose in Python that could be a guard in the column definition function.


Exactly, this is an error that should've been picked up statically, before unit even.


That would be nice. I've been using Keepass2android for years now though, and it's been really great!



Also been using it for a while. No complaints here.

Funny enough, it uses the zxcvbn Java clone [1] I wrote to estimate password strength and for new password generation.

[1]: https://github.com/GoSimpleLLC/nbvcxz


+1 for KeePassDX, works great with my KeePassXC database.


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.


I've been using Postale for a for a few years now, it's been very solid and the pricing is reasonable!


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.

[1] https://techspot.zzzeek.org/2015/02/15/asynchronous-python-a...


Have you tried Django Ninja? https://django-ninja.rest-framework.com

It's most of FastAPI (auto docs generation, great Pydantic integration, etc) but for Django.


Never seen that before, looks good!


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?


I'm using it mostly for full-stack web development with ScalaJS (https://www.scala-js.org) in the frontend (https://outwatch.github.io/docs/readme.html) and in the backend with AWS lambdas.

The ecosystem is currently in the process of porting all the libraries to Scala 3. So if you're new to Scala, I'd recommend to start with Scala 2, which is rock-solid and already very powerful.

I never worked with SQLAlchemy. But on the scala database side, popular libraries are Doobie (https://tpolecat.github.io/doobie) and Quill (https://getquill.io). Keep in mind that these are for Scala on the JVM. On the ScalaJS side I'm using the javascript library pg. But I'd like to try if it works well with Prisma soon.

The nice thing about ScalaJS is, that you can use Javascript libraries. And if there are typescript facades, then you can transpile these to Scala and use them in a type safe way (https://scalablytyped.org).


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


That sounds extremely frustrating. Maybe a good workaround is a custom domain?


Be aware that custom domains come with their own problems. Not being blacklisted is one of them.


I've never had this issue with a personal custom domain. Basically all businesses have custom domains so blacklisting all of them can't make sense, surely?


Using a custom domain doesn't necessarily mean using a custom mail server, they can point to a really common mail server such as gmail for instance. This is how a lot of business emails are set up.


True, but then I would assume that serious monitoring apparatus would include mail server monitoring, therefore defeating the need for a custom domain, which may contribute to identify you and/or stigmatise you further. Especially if one is accounting for other traffic carried by the said custom domain.


Oh I see. Yeah we use google mail for our business and I use fast mail, both with custom domains.


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.


For API backends mostly Express + postgraphile (basic CRUD operations) + socket.io (realtime features). Currently exploring Prisma 2 as replacement for Knex.js (query builder). Knex.js does everything I need except having automatic TypeScript integration. Prisma 2 has fantastic TypeScript integration but lacks many features.

I write my own validation logic and use the same code on the frontend (React+MobX) and backend. Automatic API docs are less important for me as I don't have third party API access and use TypeScript interfaces as API contracts. I run my own business and stuff like validation is something I write only once, and perhaps update and extend every now and then. If you develop many projects for external clients, this setup might be to involved and I can see why something like FastAPI is a timesaver.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: