Pydandic don't work like i except #937
-
First Check
Commit to Help
Example Codefrom pydantic import PositiveInt
from sqlalchemy import create_engine
from sqlmodel import Field, Session, SQLModel
from app.adapter.exception.app_exception import AppException
class Personage(SQLModel, table=True):
id: Optional[int] = Field(default=None, primary_key=True)
name: str = Field(max_length=20, min_length=2)
age: PositiveInt DescriptionPydantic allow me to do everything i want with data, it is not typesafe at all. full code here : https://github.com/AlexTraveylan/sql_model_training Operating SystemWindows Operating System DetailsNo response SQLModel Version0.0.18 Python VersionPython 3.12.2 Additional ContextI love using SQLAlchemy and Pydantic together with FastAPI, I was about to create something similar to SQLModel, however, it does not meet my needs. The models appear to inherit poorly from BaseModel or maybe I am doing it wrong. Anyway, I don't know if it's a bug or not, but I can't use this library because of it. I would like to contribute rather than create my own thing if possible. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
When |
Beta Was this translation helpful? Give feedback.
When
table=True
the validation is turned off.Check that thread for alternatives solutions: #52