-
First Check
Commit to Help
Example Code"""Main module"""
from typing import Optional
from sqlmodel import Field, SQLModel
class Hero(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
name: str
secret_name: str
age: Optional[int] = None
hero_1 = Hero(name="Deadpond", secret_name="Dive Wilson")
hero_2 = Hero(name="Spider-Boy", secret_name="Pedro Parqueador")
hero_3 = Hero(name="Rusty-Man", secret_name='Tom')
a = hero_1.name + 5Descriptionhttps://github.com/tiangolo/sqlmodel/blob/main/docs/index.md#editor-support suggests that inline errors will be automatic. At least in VSCode, they are not. Docs need clarification on how to achieve this. Wanted SolutionDocs should note that additional vscode config is needed to get inline errors. Wanted Code"python.analysis.diagnosticSeverityOverrides": {
"reportGeneralTypeIssues": "information"
} |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
The issue ended up being missformated. Here is the screenshot that was expected to be attached: |
Beta Was this translation helpful? Give feedback.
-
|
Wouldn't it be better to just advice enabling all type checking errors at "python.analysis.typeCheckingMode": "basic"In my experience, other type checking errors can be very helpful too. |
Beta Was this translation helpful? Give feedback.
-
|
@FaresAhmedb - sure, |
Beta Was this translation helpful? Give feedback.
-
|
I'm coming years later to this 😅 But in case anyone is still struggling, SQLModel uses modern standard types, including In most cases, the issues with editors come from them not being able to detect the specific Python virtual environment used, or having an incorrect one configured. And then not being able to parse/import and use the source for SQLModel to understand its types. Using uv would help standardize the way venvs are found, and then checking in the docs for the specific editor about selecting the Python environment to be used. |
Beta Was this translation helpful? Give feedback.

I'm coming years later to this 😅
But in case anyone is still struggling, SQLModel uses modern standard types, including
dataclass_transform. So, any editor that supports modern types would be able to work with it and provide inline errors and autocompletion.In most cases, the issues with editors come from them not being able to detect the specific Python virtual environment used, or having an incorrect one configured. And then not being able to parse/import and use the source for SQLModel to understand its types.
Using uv would help standardize the way venvs are found, and then checking in the docs for the specific editor about selecting the Python environment to be used.