May I add an extra overload for the select
function, for 5 arguments, or is there a reason for this limit?
#1280
-
First Check
Commit to Help
Example Codefrom sqlmodel import select
from my_models import User, Comments, Preferences, Likes, Wishlist
# No overloads for "select" match the provided arguments: ...
# Would type fine for 1-4 arguments
query = select(User, Comments, Preferences, Likes, Wishlist) DescriptionI am trying to write a select statement that selects 5 different SQLModel children. However I get a type error as the overloads for Other people have had this issue too, eg here. The fix seems to be to fallback to SQLAlchemy, but then we lost the beautiful typing of SQLModel. I am happy to fix this problem by adding extra overloads. Or is there some reason this is capped to 4? Thank you very much and I'll do my best to push the help forward! Operating SystemmacOS Operating System DetailsNo response SQLModel Version0.0.22 Python Version3.11.9 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Seems like it would even be as trivial as just increasing the following and then regenerating the source file: sqlmodel/scripts/generate_select.py Line 16 in 7d00768 Might as well go up to like 10 or 20 since it's just autogenerated at no additional effort. |
Beta Was this translation helpful? Give feedback.
-
This is really confusing behaviour. I was double-checking all of my tables to see if I was missing some definition until I figured out that the total number of tables in the |
Beta Was this translation helpful? Give feedback.
-
The docstring does not document this limitation: from sqlmodel import select
help(select)
It looks like |
Beta Was this translation helpful? Give feedback.
There are technical reasons for this limitation turns out, stemming from Python's type system. I've opened a PR to at least increase it to 5 :)