You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
Davidonium
changed the title
Cannot infer type of "Column" when server_default kwarg is set on a @declarative_attr
Cannot infer type of "Column" when server_default and default kwargs are set on a @declarative_attr
Oct 16, 2021
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?
Davidonium
changed the title
Cannot infer type of "Column" when server_default and default kwargs are set on a @declarative_attr
Cannot infer type of "Column" when server_default and default kwargs are set on a @declared_attr
Oct 16, 2021
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.
The text was updated successfully, but these errors were encountered: