Open Davidonium opened 3 years ago
Hi,
Thanks for reporting.
Just a guess. removing default=datetime.utcnow,
improve things? Setting default when using server_default is probably not the very usual, since default would be used by sqlalchemy instead of server_default
In any case this is probably a bug in the stubs.
After trying, it does work so I guess that the bug is when setting both server_default
and default
at the same time. Setting only one of them makes mypy pass, so I guess this is rather strange to encounter (I did this from lack of experience with sqlalchemy). I'll change the description.
Thanks for testing that change.
Settings both is supported, even if unusual, I think, so we should try to resolve the issue.
@zzzeek can you confirm that we support this case?
Describe the bug When adding the
server_default
kwarg to a Column declarative_attr, mypy complains like this:not really sure if I am doing something wrong but I am doing as stated here: https://docs.sqlalchemy.org/en/14/core/metadata.html?highlight=server_default#sqlalchemy.schema.Column.params.server_default
Expected behavior mypy to not error
To Reproduce This snippet should reproduce the error:
Then run mypy with sqlalchemy2-stubs on this file.
Error
Versions.
macOS Catalina 10.15.7
Python 3.9.5
1.4.23
mypy 0.910
0.0.2-alpha.18
Many thanks in advance.