Skip to content

Pyright warnings in strict mode: type is partially unknown for op.create_index #1191

Closed

Description

@AlexanderPodorov

Example of op.create_index:
op.create_index(op.f('ix_token_expired_at'), 'token', ['expired_at'], unique=False)
warning: Type of "create_index" is partially unknown
reason (most likely): columns parameter has type Sequence[str | TextClause | Function[Unknown]]. Function generic is missing type parameter.

Expected behavior
No warnings produced

Versions.

  • OS: MacOS
  • Python: 3.11.2
  • Alembic: 1.9.4
  • SQLAlchemy: 2.0.4
  • Database: Postgres 15
  • DBAPI: asyncpg

Additional context
See: sqlalchemy/sqlalchemy#9391

Thanks!

Activity

  1. added
    bugSomething isn't working
    pep 484typing related issues
    and removed
    requires triageNew issue that requires categorization
    on Mar 6, 2023
  2. CaselIT commented on Mar 6, 2023

    @CaselIT
    Member

    Hi,

    Thanks for re-reporting. Sorry for moving the previous issue

  3. AlexanderPodorov commented on Mar 6, 2023

    @AlexanderPodorov
    Author

    Hi, no worries, let me know if you need anything.

  4. sqla-tester commented on Mar 6, 2023

    @sqla-tester
    Collaborator

    CaselIT has proposed a fix for this issue in the main branch:

    Correctly account for generic in Function https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/4492

  5. zzzeek commented on Mar 7, 2023

    @zzzeek
    Member

    funny that mypy doesnt complain

  6. CaselIT commented on Mar 7, 2023

    @CaselIT
    Member

    Mypy is a bit leaking in some regards.

    Is seels it also doesn't know that enume are iterable :/ (not related to this change)

  7. added a commit that references this issue on Sep 27, 2024
    bc0c305
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpep 484typing related issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions