Skip to content
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

attempt to use pep-646 variadic generics for Row, Result, select(), others #1

Closed
zzzeek opened this issue Mar 2, 2021 · 3 comments
Closed
Labels
awaiting pep Required behavior is not yet implemented and there's a pep for it

Comments

@zzzeek
Copy link
Member

zzzeek commented Mar 2, 2021

it's only in Python 3.10, the ability to make our own types that are like tuples:

https://www.python.org/dev/peps/pep-0646/

what we would want is:


stmt: Select[User, str, int]  = select(User, Address.name, Address.id).join_from(User, Address)

result: Result[User, str, int] = session.execute(stmt)

for row: Row[User, str, int] in result:
    # ...

that is, every ReturnsRows class as well as Result and Row become some kind of covariant variadic generic. is that every word ?

@zzzeek
Copy link
Member Author

zzzeek commented Mar 2, 2021

here's from the original discussion for pep 646: python/typing#193 (comment)

@zzzeek
Copy link
Member Author

zzzeek commented Dec 29, 2021

superseded by sqlalchemy/sqlalchemy#7516 for 2.0

@CaselIT
Copy link
Member

CaselIT commented Dec 29, 2021

we could have transferred it. In any case I think we can just close this

@CaselIT CaselIT closed this as completed Dec 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting pep Required behavior is not yet implemented and there's a pep for it
Projects
None yet
Development

No branches or pull requests

2 participants