We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
from pydantic import ValidationError from sqlmodel import Field, SQLModel class test_base(SQLModel): name: str | None = None value: float | None = None class test_strict(test_base): name: str value: float class test_table(test_base, table=True): id: int | None = Field(None, primary_key=True) name: str value: float class test_table_from_strict(test_strict, table=True): id: int | None = Field(None, primary_key=True) class test_table_not_override(SQLModel, table=True): id: int | None = Field(None, primary_key=True) name: str value: float test_values = [ {}, {"name": "test"}, {"name": "test", "value": 123}, {"value": 545}, {"name": "test", "value": "test"}, ] for value in test_values: print(f"{value=}") for _class in ( test_strict, test_table, test_table_from_strict, test_table_not_override, ): print(_class.__name__, end=": ") try: val = _class(**value) except ValidationError as exc: print(exc) else: print(val) print() """ value={} test_strict: 2 validation errors for test_strict name field required (type=value_error.missing) value field required (type=value_error.missing) test_table: id=None test_table_from_strict: id=None test_table_not_override: id=None value={'name': 'test'} test_strict: 1 validation error for test_strict value field required (type=value_error.missing) test_table: name='test' id=None test_table_from_strict: name='test' id=None test_table_not_override: id=None name='test' value={'name': 'test', 'value': 123} test_strict: name='test' value=123.0 test_table: name='test' value=123.0 id=None test_table_from_strict: name='test' value=123.0 id=None test_table_not_override: id=None name='test' value=123.0 value={'value': 545} test_strict: 1 validation error for test_strict name field required (type=value_error.missing) test_table: value=545.0 id=None test_table_from_strict: value=545.0 id=None test_table_not_override: id=None value=545.0 value={'name': 'test', 'value': 'test'} test_strict: 1 validation error for test_strict value value is not a valid float (type=type_error.float) test_table: name='test' id=None test_table_from_strict: name='test' id=None test_table_not_override: id=None name='test' """
Contrary to what I thought, An error should occur for the same reason as "test_strict", but it does not actually occur.
Linux
OS: Ubuntu 18.04.6 LTS x86_64 Host: Virtual Machine 7.0 Kernel: 5.4.0-1070-azure Uptime: 59 days, 16 hours, 31 mins Packages: 1492 Shell: zsh 5.4.2 Resolution: 1920x1080, 2560x1080 WM: GNOME Shell WM Theme: Adwaita Theme: Adwaita [GTK3] Icons: Adwaita [GTK3] Terminal: vscode CPU: Intel Xeon E5-2673 v4 (2) @ 2.294GHz GPU: Microsoft Corporation Hyper-V virtual VGA Memory: 4553MiB / 16010MiB
0.0.6
Python 3.10.3
No response
The text was updated successfully, but these errors were encountered:
no from_orm, no parse_obj, use validate method.
Sorry, something went wrong.
Duplicate of #134 and #52
No branches or pull requests
First Check
Commit to Help
Example Code
Description
Contrary to what I thought,
An error should occur for the same reason as "test_strict", but it does not actually occur.
Operating System
Linux
Operating System Details
OS: Ubuntu 18.04.6 LTS x86_64
Host: Virtual Machine 7.0
Kernel: 5.4.0-1070-azure
Uptime: 59 days, 16 hours, 31 mins
Packages: 1492
Shell: zsh 5.4.2
Resolution: 1920x1080, 2560x1080
WM: GNOME Shell
WM Theme: Adwaita
Theme: Adwaita [GTK3]
Icons: Adwaita [GTK3]
Terminal: vscode
CPU: Intel Xeon E5-2673 v4 (2) @ 2.294GHz
GPU: Microsoft Corporation Hyper-V virtual VGA
Memory: 4553MiB / 16010MiB
SQLModel Version
0.0.6
Python Version
Python 3.10.3
Additional Context
No response
The text was updated successfully, but these errors were encountered: