Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Pretty cool post! I'm not sure how I feel about SQLAlchemy (not the star of the post but mentioned quite a bit); it's such a big ball of state that has so many surprises, I wonder if some people build entirely without it.


I recently built a personal project using peewee and it doesn't have a ton of bells and whistles but it works well for what it does do.


Do you use type hints? I was quite excited by peewee until I discovered the author's stance on type hints in python:

> I think type hints are misguided and unpythonic, and it's my stance that they will never be supported by peewee. Python is a high-level dynamic language, peewee plays to these strengths. You couldn't implement peewee in go, it'd look completely different.

There are thirdparty stubs available though, so I wonder how well these work.

PS: I do get that Python's type system might lack the expressiveness to fully support all ORM-like functionality, but I don't think that's a reason to not even provide hints for the super simple cases like `Person.select()`.


There is a rather big difference between traditional SQLAlchemy and Advanced Alchemy which is also made by Litestar. We've build with pure SQL and with SQLAlchemy in the past, but since we transitioned from django ninja to Litestar, we've not used SQLAlchemy and are slowly moving away from it. Well I guess Advanced Alchemy is still SQLAlchemy under the hood.


Mind elaborating a bit on why you migrated away from django ninja? Just curious, I’ve been using it for some small side projects and have enjoyed it.


Djangi-ninja is excellent, but it's still Django and when you aren't using a lot of the "batteries included" then you're not really using Django. I mentioned SQLAlchemy which is already "fighting Django" compared to using Django Orm as an example. We picked Litestar because it's natively async, makes it easy to use dataclasses rather than Pydantic, has really fast cold start and it has great interoperability with Advanced Alchemy.

I think Django is great, and by extension that Django-Ninja is too. Considering it runs Instagram it certainly scales as well, but unlike Instagram we aren't enough engineers to be able of ripping out more and more batteries while replacing them with our own specialized batteries.


The most interesting thing about this project to me is that it appears to alleviate some of the warts of working with SqlAlchemy.

Pretty much every time I start a project that needs a DB I just use Django. SqlAlchemy and Alembic are usually not worth dealing with.


I think the way to go with SQLAlchemy is to use the models and alembic for migrations and schema definition but to write the sql and do transaction management by hand. Losing time to figure out how a query you know how to write can be constructed within the ORM is just too much imo.


I usually just use asyncpg.


You can use asyncpg in SQLAlchemy


Yep! But I don't.


Lol same, writing SQL and directly wrangling Async connection pools always seemed way easier for me than trying to jam sqlalchemy into whatever hole I'm working with.




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

Search: