We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
Storing an instance of sqlalchemy.dialects.postgresql.UUID to a variable and re-using that in the column declarations is seen as NullType.
sqlalchemy.dialects.postgresql.UUID
NullType
Expected behavior
Type should be detected as Column[UUID]?
Column[UUID]
To Reproduce
from typing import Optional from uuid import UUID from sqlalchemy import Column from sqlalchemy.dialects.postgresql import UUID as PostgresUUID from sqlalchemy.orm import declarative_base PgUUID = PostgresUUID(as_uuid=True) Base = declarative_base() class Foobar(Base): __tablename__ = "foobar" works: Optional[UUID] = Column(PostgresUUID(as_uuid=True)) doesnt: Optional[UUID] = Column(PgUUID)
Error
Running with sqlalchemy.ext.mypy.plugin enabled in mypy configs:
sqlalchemy.ext.mypy.plugin
mypy
$ mypy foobar.py foobar.py:15: error: Incompatible types in assignment (expression has type "Column[NullType]", variable has type "UUID") [assignment] Found 1 error in 1 file (checked 1 source file)
Versions.
3.9.9
1.4.39
mypy 0.971
0.0.2a25
The text was updated successfully, but these errors were encountered:
Also construction gives violation:
Foobar( works=uuid.uuid4(), doesnt=uuid.uuid4(), )
$ mypy foobar.py ... foobar.py:20: error: Unexpected keyword argument "doesnt" for "Foobar" [call-arg] ...
Sorry, something went wrong.
No branches or pull requests
Describe the bug
Storing an instance of
sqlalchemy.dialects.postgresql.UUID
to a variable and re-using that in the column declarations is seen asNullType
.Expected behavior
Type should be detected as
Column[UUID]
?To Reproduce
Error
Running with
sqlalchemy.ext.mypy.plugin
enabled inmypy
configs:Versions.
3.9.9
1.4.39
mypy 0.971
0.0.2a25
The text was updated successfully, but these errors were encountered: