Open LeiYangGH opened 1 month ago
searched and found one stackoverflow answer and solved with
class Config:
orm_mode = True
but the fastapi-crudrouter doc explains nothing on this topic. Could fastapi-crudrouter doc be updated to
orm_mode
globally and not in every BaseModel
?
This project is very useful and I want to use it in production, thanks a lot! I have tried the basic In Memory demo and works just as expected.
But when first try with mysql database, validation errors occurred.
I have searched and only found one closed issue with such error message. but my case is much simpler(if not simplest) and my model has only one field: the auto increase integer primary key.
code is like below
log
pip freeze
annotated-types==0.7.0 anyio==3.7.1 certifi==2024.7.4 click==8.1.7 colorama==0.4.6 dnspython==2.6.1 email_validator==2.2.0 fastapi==0.111.1 fastapi-cli==0.0.4 fastapi-crudrouter==0.8.6 greenlet==3.0.3 h11==0.14.0 httpcore==1.0.5 httptools==0.6.1 httpx==0.27.0 idna==3.7 Jinja2==3.1.4 markdown-it-py==3.0.0 MarkupSafe==2.1.5 mdurl==0.1.2 mysqlclient==2.2.4 pydantic==1.10.17 pydantic_core==2.0.1 Pygments==2.18.0 python-dotenv==1.0.1 python-multipart==0.0.9 PyYAML==6.0.1 rich==13.7.1 shellingham==1.5.4 sniffio==1.3.1 SQLAlchemy==2.0.31 starlette==0.37.2 typer==0.12.3 typing_extensions==4.12.2 uvicorn==0.30.4 watchfiles==0.22.0 websockets==12.0
python version
(fapi) D:\G\fapi>python --version Python 3.11.9
system
win 11
note I must use pydantic==1.* due to other issues. Tried downgrade
fastapi
,pydantic
,SQLAlchemy
but none of them fixed such error, or cause more other errors.