First Check
Commit to Help
Example Code
fromsqlmodelimportSQLModelreveal_type(SQLModel.__tablename__)
# mypy(0.910) output: Revealed type is "Union[builtins.str, def (*Any, **Any) -> builtins.str]"# pyright(1.1.166) output: Type of "SQLModel.__tablename__" is "declared_attr"classUser(SQLModel, table=True): # pyright error: Instance variable "__name__" overrides class variable of same name in class "SQLModel"__tablename__="users"# pyright error: Expression of type "Literal['users']" cannot be assigned to declared type "declared_attr"name: str
Description
This will cause a type error when you declare __tablename__ with pyright as type checker. Like:
Expression of type "Literal['users']" cannot be assigned to declared type "declared_attr"
Operating System
Linux, macOS
Operating System Details
No response
SQLModel Version
0.0.4
Python Version
3.8.6
Additional Context
No response
First Check
Commit to Help
Example Code
Description
This will cause a type error when you declare
__tablename__with pyright as type checker. Like:Operating System
Linux, macOS
Operating System Details
No response
SQLModel Version
0.0.4
Python Version
3.8.6
Additional Context
No response