I'm using SQLAlchemy, Alembic, and FastAPI. Either this is for someone much more advanced than me, or it could use some examples showing "This is clunky in SQLAlchemy and easy in Advanced-Alchemy." When you look at SQLModel[1] from FastAPI, which I did adopt, it does a much better job at promising "this will make your life easier".
I don't like SQLModel for the simple reason that it muddles boundaries between different parts of the application. I suppose when you have a pure CRUD app it's ok, but anytime you want to handle ORM objects and apply some business logic; you'll want to cleanly separate those from what you send and receive from your API.
Hello, OP there, I have many use cases that fall outside of FastAPI or web apps in general, and this pattern allows me to consolidate that logic in a re-usable way.
We also have SQLSpec[1] (Work in progress) that could maybe a better use case for you with raw SQL
FastAPI and it's very opinionated "ecosystem" of "easy to use" and "hipster-esque documented" tools are fast-becoming a horrible one-man show version of Django, and we will all regret going so deep into it using it, one day. Until then, sure we can use it and it mostly makes sense and it mostly works really very well. Hopefully the community matures and moves away from opinionated tooling that forces you into the "one true way".
I use this library in production; it has great tools and features that I couldn't find in Python, that I missed from other frameworks or languages. The only downside is that you have to figure out what is what from the code; the documentation is not good. But once you figure out the details, it's downhill from there.
We use this with the Litestar framework; there are things that I hate, but in general, it works out really well. Especially, if you managed to set up your services, repositories correctly, then many things happen magically.
Though I suggest anyone who'd like to "taste" these use `msgspec` as a serialisation library. We hit the wall earlier when we wanted to use Pydantic in complex schemas for serialisation, so we went back to msgspec. The downside is that msgspec misses the validation part.
Anyway, I recommend that anyone go beyond the regular SQLAlchemy.
I like the syntax `account = await accounts_service.get_one_or_none(*filters, id=account_id)` a lot.
I would acknowledge they have been lacking and if they'd reviewed them recently. If so, maybe see if they'd offer some improvement areas.
Do you have anything in mind in the documentation that you would like improved?
This is a nice library and a really big time savings part of the litestar ecosystem. The litestar community has been really great and helpful in my experience so a big thank you to all the guys and gals over there!
I'm using SQLAlchemy, Alembic, and FastAPI. Either this is for someone much more advanced than me, or it could use some examples showing "This is clunky in SQLAlchemy and easy in Advanced-Alchemy." When you look at SQLModel[1] from FastAPI, which I did adopt, it does a much better job at promising "this will make your life easier".
1. https://sqlmodel.tiangolo.com/
I don't like SQLModel for the simple reason that it muddles boundaries between different parts of the application. I suppose when you have a pure CRUD app it's ok, but anytime you want to handle ORM objects and apply some business logic; you'll want to cleanly separate those from what you send and receive from your API.
Hello, OP there, I have many use cases that fall outside of FastAPI or web apps in general, and this pattern allows me to consolidate that logic in a re-usable way.
We also have SQLSpec[1] (Work in progress) that could maybe a better use case for you with raw SQL
1. https://github.com/litestar-org/sqlspec
FastAPI and it's very opinionated "ecosystem" of "easy to use" and "hipster-esque documented" tools are fast-becoming a horrible one-man show version of Django, and we will all regret going so deep into it using it, one day. Until then, sure we can use it and it mostly makes sense and it mostly works really very well. Hopefully the community matures and moves away from opinionated tooling that forces you into the "one true way".
I use this library in production; it has great tools and features that I couldn't find in Python, that I missed from other frameworks or languages. The only downside is that you have to figure out what is what from the code; the documentation is not good. But once you figure out the details, it's downhill from there. We use this with the Litestar framework; there are things that I hate, but in general, it works out really well. Especially, if you managed to set up your services, repositories correctly, then many things happen magically. Though I suggest anyone who'd like to "taste" these use `msgspec` as a serialisation library. We hit the wall earlier when we wanted to use Pydantic in complex schemas for serialisation, so we went back to msgspec. The downside is that msgspec misses the validation part.
Anyway, I recommend that anyone go beyond the regular SQLAlchemy. I like the syntax `account = await accounts_service.get_one_or_none(*filters, id=account_id)` a lot.
I would acknowledge they have been lacking and if they'd reviewed them recently. If so, maybe see if they'd offer some improvement areas. Do you have anything in mind in the documentation that you would like improved?
Code examples could be further forward, I clicked around a bit and didn't see any on the initial pages.
For some else who's looking, they're folded in the readme under "click for more details": https://github.com/litestar-org/advanced-alchemy/blob/v1.3.1...
This is a nice library and a really big time savings part of the litestar ecosystem. The litestar community has been really great and helpful in my experience so a big thank you to all the guys and gals over there!
I don't think I ever worked with an ORM that turned against me more than SQLAlchemy and that's not because it's badly written, on the contrary.
Nice, love seeing litestar continue improving!