Why sqlmodel_update method don't ignore the None fields automatically?
#1680
Unanswered
lucasmsoares96
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
First Check
Commit to Help
Example Code
Description
To use the db_hero.sqlmodel_update method when a field has a None value, it is currently necessary to convert the typed BaseModel object into an untyped dictionary before updating it:
However, converting the model to a dictionary removes static analysis and autocompletion. The codebase would be more concise and safer if the sqlmodel_update method could automatically ignore None fields.
Operating System
Linux
Operating System Details
OS: Ubuntu 24.04.3 LTS x86_64
Host: 550XDA P23CFB
Kernel: 6.14.0-37-generic
Shell: zsh 5.9
Resolution: 1920x1080
DE: GNOME 46.0
CPU: 11th Gen Intel i7-1165G7 (8) @ 4.700GHz
GPU: Intel TigerLake-LP GT2 [Iris Xe Graphics]
Memory: 10625MiB / 15716MiB
SQLModel Version
0.0.27
Python Version
3.12.3
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions