▲ | youdontknowjuli 10 hours ago | |
> (and some cool hackery to make SQLAlchemy feel very typed and work nicely with Pydantic). Sounds interesting. Can you elaborate on the cool hackery? We introduced SQLModel recently but struggle in a few cases (e.g. multi-level joins). Do you know reference projects for SQLAlchemy and pydantic? | ||
▲ | tasn 4 hours ago | parent [-] | |
My info is maybe a bit dated, as it's been a while since we wrote this hackery. We also adopted SQLModel at some point but we had to patch it to work well (I think some of my contributions are now in upstream). As for some of the hacks:
To make it possible to access sqlmodel properties as columns for doing things like `in_` but still maintaining type safety.Added types ourselves to the base model like this:
Added functions that help with typing like this:
and stuff like this for relationships:
I hope this helps, I don't have time to find all the stuff, but we also hacked on SQLAlchemy a bit, and in other places. |