-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
joined unique() question #96
Comments
Hello @hgalytoby which version of fastapi, pydantic and sqlmodel are you using? |
fastapi 0.97.0 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 #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.
The text was updated successfully, but these errors were encountered: