dataclass constructor expects Mapped[]
values when using _mypy_mapped_attrs
#129
Labels
mypy plugin
something that has to do with the sqlalchemy mypy plugin
Describe the bug
Following the mypy support instructions here and trying variations from here, I cannot find a way to get type checking to work for both the fields as clause elements and the dataclass constructor. Removing
_mypy_mapped_attrs
results in a usable constructor, but unusable fields for constructing a query.Expected behavior
That the dataclass constructor would be type checked according to the actual field type annotations. Instead, the presence of
_mypy_mapped_attrs
causes mypy to expectMapped
values to be passed to the constructor, so creating an instance does not pass type checking.To Reproduce
Error
Versions.
Additional context
Alternative mapping that produces the same error:
The text was updated successfully, but these errors were encountered: