Join onclause
yields pyright
error: Argument of type "bool" cannot be assigned to parameter "onclause" of type "_OnClauseArgument"
#1391
-
First Check
Commit to Help
Example CodePlease see #1390, which I won't copy to here. Hope that is ok. Description
st = (
select(Child, mum := aliased(Parent), dad := aliased(Parent))
.join(mum, Child.mother_id == mum.id) # pyright reports an error here,
.join(dad, Child.father_id == dad.id) # and here… see below
)
I replicated the exact same code using pure SQLAlchemy, and I don't see the error there. I suspect it's due to (having to) use Operating SystemLinux Operating System DetailsDebian unstable SQLModel Version0.0.24 Python Version3.13.1 Additional ContextI was forced to check "I have already search in Google", and I had to lie. I do not use Google. However, I searched the Web using Brave. It would be nice to reword this. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Use from sqlmodel import col
...
.join(mum, col(Child.mother_id) == mum.id) |
Beta Was this translation helpful? Give feedback.
Use
col
: