Skip to content

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

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
AlexanderPodorov opened this issue Mar 6, 2023 · 5 comments
Labels
bug Something isn't working pep 484 typing related issues

Comments

@AlexanderPodorov
Copy link

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!

@AlexanderPodorov AlexanderPodorov added the requires triage New issue that requires categorization label Mar 6, 2023
@CaselIT CaselIT added bug Something isn't working pep 484 typing related issues and removed requires triage New issue that requires categorization labels Mar 6, 2023
@CaselIT
Copy link
Member

CaselIT commented Mar 6, 2023

Hi,

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

@AlexanderPodorov
Copy link
Author

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

@sqla-tester
Copy link
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

@zzzeek
Copy link
Member

zzzeek commented Mar 7, 2023

funny that mypy doesnt complain

@CaselIT
Copy link
Member

CaselIT commented Mar 7, 2023

Mypy is a bit leaking in some regards.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pep 484 typing related issues
Projects
None yet
Development

No branches or pull requests

4 participants