Pydandic don't work like i except #937
Answered
by
joachimhuet
AlexTraveylan
asked this question in
Questions
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: PositiveIntDescriptionPydantic 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. |
Answered by
joachimhuet
May 12, 2024
Replies: 1 comment 1 reply
|
When |
1 reply
Answer selected by
YuriiMotov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

When
table=Truethe validation is turned off.Check that thread for alternatives solutions: #52