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
I used the GitHub search to find a similar question and didn't find it.
I searched the SQLModel documentation, with the integrated search.
I already searched the Web "How to X in SQLModel" and didn't find any information.
I already read and followed all the tutorial in the docs and didn't find an answer.
I already checked if it is not related to SQLModel but to Pydantic.
I already checked if it is not related to SQLModel but to SQLAlchemy.
Commit to Help
I commit to help with one of those options 👆
Example Code
Please see #1390, which I won't copy to here. Hope that is ok.
Description
pyright reports an error on the two join lines:
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
)
Argument of type "bool" cannot be assigned to parameter "onclause" of type "_OnClauseArgument |
None" in function "join"
Type "bool" is not assignable to type "_OnClauseArgument | None"
"bool" is not assignable to "ColumnElement[Any]"
"bool" is incompatible with protocol "_HasClauseElement[Any]"
"clause_element" is not present
"bool" is not assignable to "SQLCoreOperations[Any]"
"bool" is not assignable to "ExpressionElementRole[Any]"
"bool" is not assignable to "TypedColumnsClauseRole[Any]"
Type "bool" is not assignable to type "() -> ColumnElement[Any]"
... [reportArgumentType]
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 sqlalchemy.orm.aliased since sqlmodel seems not to provide such a wrapper. For now, it's #type:ignore for me, but maybe someone has a solution…?
Operating System
Linux
Operating System Details
Debian unstable
SQLModel Version
0.0.24
Python Version
3.13.1
Additional Context
I 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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Please see #1390, which I won't copy to here. Hope that is ok.
Description
pyright
reports an error on the two join lines:None" in function "join"
Type "bool" is not assignable to type "_OnClauseArgument | None"
"bool" is not assignable to "ColumnElement[Any]"
"bool" is incompatible with protocol "_HasClauseElement[Any]"
"clause_element" is not present
"bool" is not assignable to "SQLCoreOperations[Any]"
"bool" is not assignable to "ExpressionElementRole[Any]"
"bool" is not assignable to "TypedColumnsClauseRole[Any]"
Type "bool" is not assignable to type "() -> ColumnElement[Any]"
... [reportArgumentType]
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
sqlalchemy.orm.aliased
sincesqlmodel
seems not to provide such a wrapper. For now, it's#type:ignore
for me, but maybe someone has a solution…?Operating System
Linux
Operating System Details
Debian unstable
SQLModel Version
0.0.24
Python Version
3.13.1
Additional Context
I 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.
All reactions