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
Hello, I've an interesting issue and a suggestion here.
Next example is OK at runtime. It's connected with how SQLAlchemy initializes models when creates them using setattr or smth similar. So whatever attribute is passed it will be set regardless of whether such a column exists or not.
As it's shown we have a private field and the descriptor to get its value having some kind of additional logic.
Thanks to sqlalchemy-stubs, mypy sees problem when it is passed to __init__ a keyword that is not a column at all.
However, in the example above x field is a descriptor and it will be initialized as expected at runtime. It mimics a valid parameter and an argument to initialize a model with. You can't spot the difference from the outside.
It seems possible to support such a kind of descriptor checking, am I right?
Could it be a use case for sqlalchemy-stubs?
The text was updated successfully, but these errors were encountered:
Hello, I've an interesting issue and a suggestion here.
Next example is OK at runtime. It's connected with how SQLAlchemy initializes models when creates them using setattr or smth similar. So whatever attribute is passed it will be set regardless of whether such a column exists or not.
As it's shown we have a private field and the descriptor to get its value having some kind of additional logic.
Thanks to
sqlalchemy-stubs
,mypy
sees problem when it is passed to__init__
a keyword that is not a column at all.However, in the example above
x
field is a descriptor and it will be initialized as expected at runtime. It mimics a valid parameter and an argument to initialize a model with. You can't spot the difference from the outside.It seems possible to support such a kind of descriptor checking, am I right?
Could it be a use case for sqlalchemy-stubs?
The text was updated successfully, but these errors were encountered: