-
-
Notifications
You must be signed in to change notification settings - Fork 666
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
Unexpected argument(s)
warning in PyCharm when using select()
with many parameters
#92
Comments
Unexpected argument(s)
warning in PyCharm when using select()
with many parameters
I have the same issue. I have a table with 5 foreign keys. And when I want to do a full join like below I get a mypy error. So I assume the typing is the issue here. And PyCharm uses the types too I think. from sqlmodel import select
...
stmt = (
select(
Ticket, TicketStage, ConspicuityType, User, ATFeedbackType, StatisticalEvaluationType
)
.join(TicketStage)
.join(ConspicuityType)
.join(User)
.join(ATFeedbackType)
.join(StatisticalEvaluationType)
) And when I use from typing_extensions import reveal_type
from sqlmodel import select
...
stmt = (
select(
Ticket, TicketStage, ConspicuityType, User, ATFeedbackType, StatisticalEvaluationType
)
.join(TicketStage)
.join(ConspicuityType)
.join(User)
.join(ATFeedbackType)
.join(StatisticalEvaluationType)
)
reveal_type(stmt) # Type of "stmt" is "Any" When I reduce the arguments to select I get: from typing_extensions import reveal_type
from sqlmodel import select
...
stmt = (
select(
Ticket, TicketStage, ConspicuityType, User
)
.join(TicketStage)
.join(ConspicuityType)
.join(User)
.join(ATFeedbackType)
.join(StatisticalEvaluationType)
)
reveal_type(stmt) # Type of "stmt" is "Select[Tuple[Ticket, TicketStage, ConspicuityType, User]]" When I use from typing_extensions import reveal_type
from sqlalchemy import select
...
stmt = (
select(
Ticket, TicketStage, ConspicuityType, User, ATFeedbackType, StatisticalEvaluationType
)
.join(TicketStage)
.join(ConspicuityType)
.join(User)
.join(ATFeedbackType)
.join(StatisticalEvaluationType)
)
reveal_type(stmt) # Type of "stmt" is "Select" |
Basically the issues lies here: https://github.com/tiangolo/sqlmodel/blob/main/sqlmodel/sql/expression.py#L140-L442 The overloads are hardcoded and end with 4 parameters. So I guess there are 3 Solutions:
|
Same issue here |
@tiangolo we're still having this issue in a ton of places in our code base, any we can resolve or merge max's fix? Would be a huge QOL improvement for us. Thank you !! |
First Check
Commit to Help
Example Code
Description
select()
function to write out a query with > 4 params.select()
, the query works as expected.Operating System
Windows
Operating System Details
Windows = 10
PyCharm Version = 2021.2 (Community Edition)
SQLModel Version
0.0.4
Python Version
Python 3.9.7
Additional Context
The text was updated successfully, but these errors were encountered: