Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Type postgresql.aggregate_order_by() #12463

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

Closed

Conversation

dlax
Copy link
Contributor

@dlax dlax commented Mar 25, 2025

Overloading of __init__() is needed, probably for the same reason as it is in ReturnTypeFromArgs.

Related to #6810.

@CaselIT
Copy link
Member

CaselIT commented Mar 25, 2025

let's also what in what happens in https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5799 since I proposed a slight change on the current overloads. Sadly I could not remove them, but I think I reduced at least the scope of the issue at

class _HasClauseElement(Protocol, Generic[_T_co]):
"""indicates a class that has a __clause_element__() method"""
def __clause_element__(self) -> roles.ExpressionElementRole[_T_co]: ...

or at least that is part of the problem

@dlax
Copy link
Contributor Author

dlax commented Mar 25, 2025

let's also what in what happens in https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5799 since I proposed a slight change on the current overloads.

I have to admit that this problem is not clear to me at the moment... Maybe we could track this as a dedicated issue, possibly with a reference in code? And maybe gather help from mypy people if we manage to produce a minimal example?

@dlax dlax force-pushed the typing-postgresql-aggregate_order_by branch from 25e8f01 to 98c9a76 Compare March 28, 2025 09:47
@dlax dlax marked this pull request as ready for review March 28, 2025 09:52
@dlax dlax force-pushed the typing-postgresql-aggregate_order_by branch from 98c9a76 to 0c34d5e Compare April 7, 2025 07:21
@CaselIT
Copy link
Member

CaselIT commented Apr 7, 2025

I guess in this case we don't allow a literal here, so the changes done in 084eac6 do not apply.

buy maybe only 2 overload could be enough?

@dlax
Copy link
Contributor Author

dlax commented Apr 8, 2025

but maybe only 2 overload could be enough?

Can you clarify what you mean? There are only 2 overloads in my proposal.

In fact, I only implemented what's tested (i.e. Column and mapper's attribute). If there are more use cases (now or later), we can add more overloads and tests.

@CaselIT
Copy link
Member

CaselIT commented Apr 8, 2025

indeed sorry, I counted 3 inits, but the 3rd on is the implementation.

I wounder if the second overload could be _ColumnExpressionArgument instead

Overloading of `__init__()` is needed, probably for the same reason as
it is in ReturnTypeFromArgs.

Related to sqlalchemy#6810.
@dlax dlax force-pushed the typing-postgresql-aggregate_order_by branch from 0c34d5e to 701d979 Compare April 9, 2025 06:29
@dlax
Copy link
Contributor Author

dlax commented Apr 9, 2025

I wounder if the second overload could be _ColumnExpressionArgument instead

It seems to work. Changed, thanks.

@CaselIT CaselIT requested review from sqlalchemy-bot and sqla-tester and removed request for sqlalchemy-bot April 9, 2025 07:04
Copy link
Collaborator

@sqla-tester sqla-tester left a comment

Choose a reason for hiding this comment

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

OK, this is sqla-tester setting up my work on behalf of CaselIT to try to get revision 701d979 of this pull request into gerrit so we can run tests and reviews and stuff

@sqla-tester
Copy link
Collaborator

New Gerrit review created for change 701d979: https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5839

@sqla-tester
Copy link
Collaborator

Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5839 has been merged. Congratulations! :)

@sqla-tester
Copy link
Collaborator

Gerrit review https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5840 has been merged. Congratulations! :)

sqlalchemy-bot pushed a commit that referenced this pull request Apr 10, 2025
Overloading of `__init__()` is needed, probably for the same reason as it is in `ReturnTypeFromArgs`.

Related to #6810.

Closes: #12463
Pull-request: #12463
Pull-request-sha: 701d979

Change-Id: I7e1bb4d2c48dfb3461725c7079aaa72c66f1dc03
(cherry picked from commit 09c1d3c)
@dlax dlax deleted the typing-postgresql-aggregate_order_by branch April 11, 2025 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants