Closed hgalytoby closed 4 months ago
Hello @hgalytoby which version of fastapi, pydantic and sqlmodel are you using?
fastapi 0.97.0 sql model 0.0.8 pydantic 1.10.15
This is just a minor question, I'm just curious.
I know the kit version is very old, but if it's the kit version I have no doubt.
After all, I developed this project with reference to 2022.
It's been a long time since I've used SQL and my own project is very old, so I'm asking out of curiosity and not trying to learn with the latest version.
I think if I implement the latest version, I should be able to solve the problem.
Hello! I have been developing from this template since 2022.
At that time I saw that the model was using
{"lazy": "selectin"}
and I used it myself without any problems.However, there are times when I need to use joined to improve performance, but when I use joined I have a problem with
unique()
.I came across https://github.com/jonra1993/fastapi-alembic-sqlmodel-async/issues/20 and changed selectin to use joined.
I found from https://github.com/jonra1993/fastapi-alembic-sqlmodel-async/blob/main/backend/app/app/crud/base_crud.py#L35 that unique() is not used.
I ran docker-compose-dev.yml and the API works fine.
My model uses
sa_relationship_kwargs={"lazy": "joined"}
.But in my context must use
response.unique().scalar_one_or_none()
!I would like to know why there is no problem with this project, but I am having problems.
Could it be a version issue? After all, I developed this project with reference to 2022 and the kit is a bit old.
Thanks for any feedback.