I'm using SQLModel to declare this model:
class UserBase(SQLModel, table=True):
id: Optional[int]= Field(default=None, primary_key=True)
name: str
JWT: str
password: str
When I try to get it with this statement:
statement = select(UserBase).where(
UserBase.name == user.name,
UserBase.password == user.password).options(
load_only(UserBase.JWT))
So I want to load only JWT from model or load everything but UserBase.id by using defer:
statement = select(UserBase).where(
UserBase.name == user.name,
UserBase.password == user.password).options(
defer(UserBase.id))
But SQLmodel will continuosly return UserBase.id. I can fix this by making SQL statement manually, but I want to know is there more native way?
I print all variants with defer or load_only to console - they all have SELECT userbase.id, userbase."JWT"...