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

Skip to content

Complement type annotations for ARRAY #12386

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
wants to merge 2 commits into from
Closed

Conversation

dlax
Copy link
Contributor

@dlax dlax commented Mar 1, 2025

Description

This complements the type annotations of the ARRAY class, in preparation of #12384.

Checklist

This pull request is:

  • A documentation / typographical / small typing error fix
    • Good to go, no issue or tests are needed
  • A short code fix
    • please include the issue number, and create an issue if none exists, which
      must include a complete example of the issue. one line code fixes without an
      issue and demonstration will not be accepted.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests. one line code fixes without tests will not be accepted.
  • A new feature implementation
    • please include the issue number, and create an issue if none exists, which must
      include a complete example of how the feature would look.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests.

Related to #6810

This will help when adding type annotations to ARRAY next.
@dlax dlax marked this pull request as ready for review March 1, 2025 18:31
@dlax
Copy link
Contributor Author

dlax commented Mar 3, 2025

I was also thinking about making ARRAY generic on its item_type so that, e.g., Column(ARRAY(Integer)) could be inferred as a Column[Sequence[int]]. But this can be done in a follow-up PR, maybe?

@CaselIT
Copy link
Member

CaselIT commented Mar 3, 2025

I was also thinking about making ARRAY generic on its item_type so that, e.g., Column(ARRAY(Integer)) could be inferred as a Column[Sequence[int]]. But this can be done in a follow-up PR, maybe?

makes sense doing that in a follow up pr

@dlax dlax requested a review from CaselIT March 4, 2025 09:40
@CaselIT CaselIT requested a review from sqla-tester March 5, 2025 20:59
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 c9513ce 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 c9513ce: https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5763

@sqla-tester
Copy link
Collaborator

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

@sqla-tester
Copy link
Collaborator

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

sqlalchemy-bot pushed a commit that referenced this pull request Mar 13, 2025
This complements the type annotations of the `ARRAY` class, in preparation of #12384.

This pull request is:

- [ ] A documentation / typographical / small typing error fix
	- Good to go, no issue or tests are needed
- [ ] A short code fix
	- please include the issue number, and create an issue if none exists, which
	  must include a complete example of the issue.  one line code fixes without an
	  issue and demonstration will not be accepted.
	- Please include: `Fixes: #<issue number>` in the commit message
	- please include tests.   one line code fixes without tests will not be accepted.
- [x] A new feature implementation
	- please include the issue number, and create an issue if none exists, which must
	  include a complete example of how the feature would look.
	- Please include: `Fixes: #<issue number>` in the commit message
	- please include tests.

Related to #6810

Closes: #12386
Pull-request: #12386
Pull-request-sha: c9513ce

Change-Id: If9df4708c8e597eedc79ee3990792fa6c72f1afe
(cherry picked from commit 0bf7e02)
@dlax dlax deleted the typing-array branch March 13, 2025 15:46
dlax added a commit to dlax/sqlalchemy that referenced this pull request Mar 18, 2025
Now `Column(type_=ARRAY(Integer)` is inferred as `Column[Sequence[int]]`
instead as `Column[Sequence[Any]]` previously. This only works with the `type_`
argument to Column, but that's not new.

This follows from a suggestion at
sqlalchemy#12386 (comment).

Related to sqlalchemy#6810.
dlax added a commit to dlax/sqlalchemy that referenced this pull request Mar 18, 2025
Now `Column(type_=ARRAY(Integer)` is inferred as `Column[Sequence[int]]`
instead as `Column[Sequence[Any]]` previously. This only works with the `type_`
argument to Column, but that's not new.

This follows from a suggestion at
sqlalchemy#12386 (comment).

Related to sqlalchemy#6810.
sqlalchemy-bot pushed a commit that referenced this pull request Mar 19, 2025
Now `Column(type_=ARRAY(Integer)` is inferred as `Column[Sequence[int]]` instead as `Column[Sequence[Any]]` previously. This only works with the `type_` argument to Column, but that's not new.

This follows from a suggestion at
#12386 (comment).

Related to #6810.

Closes: #12443
Pull-request: #12443
Pull-request-sha: 2fff4e8

Change-Id: I87b828fd82d10fbf157141db3c31f0ec8149caad
(cherry picked from commit 500adfa)
sqlalchemy-bot pushed a commit that referenced this pull request Mar 19, 2025
Now `Column(type_=ARRAY(Integer)` is inferred as `Column[Sequence[int]]` instead as `Column[Sequence[Any]]` previously. This only works with the `type_` argument to Column, but that's not new.

This follows from a suggestion at
#12386 (comment).

Related to #6810.

Closes: #12443
Pull-request: #12443
Pull-request-sha: 2fff4e8

Change-Id: I87b828fd82d10fbf157141db3c31f0ec8149caad
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