Skip to content

✨ Increase number_of_types to 5 to support longer select queries #1333

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

GiorgioPorgio
Copy link

@GiorgioPorgio GiorgioPorgio commented Mar 27, 2025

I am trying to write a select statement that selects 5 different SQLModel children. However I get a type error as the overloads for select are limited to 4.

I am aware there is a #839 that adds typing for select for arbitrary length :) Sadly that one does not work and will break consumers.
I resolved it's conflicts and tried it on my project and then realised that the Python type system cannot maintain specific types of variadic generic arguments without specifying them explicitly. I can provide an example if you want :)

I presume this is also the reason we went with the templating approach in the first place.

Increasing to 6+ causes mypy to hang, so I chose 5 :)

Resolves #271 (comment)

Thank you very much for your time and working on OSS!

PS: I had another PR where I fixed the conflicts of variadic typing before realising this could not work with Python's type system - so I closed it to ensure it wouldn't accidentally get merged

@@ -107,6 +107,24 @@
_T3 = TypeVar("_T3")


Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything in this file is autogenerated by running the script (*_*)

@svlandeg svlandeg changed the title increase typing to 5 args in select ✨ Increase number_of_types to 5 to support longer select queries Apr 4, 2025
@svlandeg svlandeg added the feature New feature or request label Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No overload variant of "select" matches argument types
2 participants