First Check
Commit to Help
Example Code
class HeroBase(SQLModel):
name: str
secret_name: str
age: Optional[int] = None
class HeroUpdate(HeroBase, all_optional=True):
pass
Description
Is it possible to add the ability to modify the fields of a base class to convert them to all optional with a parameter like the table=True but in this case all_optional=True? This would help eliminate the duplication when creating a class for making updates.
Wanted Solution
Set all base fields to Optional based on keyword argument.
Wanted Code
class HeroBase(SQLModel):
name: str
secret_name: str
age: Optional[int] = None
class HeroUpdate(HeroBase, all_optional=True):
pass
Alternatives
No response
Operating System
Linux, Windows
Operating System Details
No response
SQLModel Version
0.0.4
Python Version
3.8.5
Additional Context
No response
First Check
Commit to Help
Example Code
Description
Is it possible to add the ability to modify the fields of a base class to convert them to all optional with a parameter like the table=True but in this case all_optional=True? This would help eliminate the duplication when creating a class for making updates.
Wanted Solution
Set all base fields to Optional based on keyword argument.
Wanted Code
Alternatives
No response
Operating System
Linux, Windows
Operating System Details
No response
SQLModel Version
0.0.4
Python Version
3.8.5
Additional Context
No response