You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the `get` and `get_multi` methods we have the option to define a `schema_to_select` attribute, which is what actually makes the queries more efficient. When you pass a pydantic schema in `schema_to_select` to the `get` or `get_multi` methods, only the attributes in the schema will be selected.
636
638
```python
637
639
from app.schemas.user import UserRead
638
-
# Here it's selecting all of the user's data, but maybe I just need what I'll return, the UserRead
640
+
# Here it's selecting all of the user's data
639
641
crud_user.get(db=db, username="myusername")
640
642
641
-
# Now it's only selecting the data that is in UserRead. Since that's my response_model, it's all I need
643
+
# Now it's only selecting the data that is in UserRead.
0 commit comments