Open
Description
The old sqlalchemy-stubs from dropbox included an approximation for the behavior of mapped classes using declarative setup, that is
class Foo(Model):
a = Column(DateTime)
Foo.a
# type is Column[DateTime]
Foo().a
# type is datetime
They did so by defining the get method on Column here: https://github.com/dropbox/sqlalchemy-stubs/blob/master/sqlalchemy-stubs/sql/schema.pyi#L131
Maybe the same can be done for set, so that
Foo().a = 3
# wrong type, expected datetime object
Of course the whole thing is supported already when using the mypy plugin, but for example when using pylance (vscode type engine) which does not support plugins, it gets confused when using and assigning object values as mapped columns and complains about mismatching types.
I think the same is done on relationship() property
I'm unsure of the deeper implications of adding such type hints, though