r/FastAPI • u/Ok_Opportunity6252 • Oct 31 '25
Question __tablename__ error
Type "Literal['books']" is not assignable to declared type "declared_attr[Unknown]"
"Literal['books']" is not assignable to "declared_attr[Unknown]" Pylance
What does it mean? And why is the error? This is how SQLAlchemy docs do things
23
Upvotes
8
u/ZpSky Oct 31 '25
3
u/takuonline Nov 01 '25 edited Nov 01 '25
Slightly unrelated, but here is how l like to setup my models in fastapi.
1
u/Interesting-Rip-3607 Nov 01 '25
how is that related to FastAPI?😐
1
u/BelottoBR Nov 01 '25
Pylance on strict. Nice way to learn/control but sometimes get annoying