Replies: 10 comments 4 replies
|
@DurandA I was facing the same issue thanks for creating this! |
0 replies
|
Looks like the pydantic SchemaValidator.validate_python (https://docs.pydantic.dev/latest/api/pydantic_core/#pydantic_core._pydantic_core.SchemaValidator.validate_python) doesn't handle aliases. That is what is used to set the fields of an object here: |
0 replies
|
I can't make .model_dump(by_alias=True) work. It always uses the attribute name. |
2 replies
|
Did anyone find a workaround? The one mentioned in #290 seems to be working only for table-models. |
0 replies
|
Also facing this issue |
0 replies
|
for me this workaround works for pydanticv 2.6 sqlmodel 0.0.14 its similar to what #774 does from sqlmodel import SQLModel, Field
class Test:
def __init__(self, test):
self.Test = test
class Item(SQLModel):
test: str = Field(schema_extra={"validation_alias": "Test"})
t1= Test("1")
Item.model_validate(t1)
Item.model_validate({"Test": "1"}) |
2 replies
|
I'm facing this issue as well and the above solution doesn't help with dumping |
0 replies
|
Thanks for reporting! Created issue to track this: #1536 |
0 replies
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
Modelwith aFieldthat contain an aliasOperating System
Linux
Operating System Details
No response
SQLModel Version
0.0.14
Python Version
Python 3.12.0
Additional Context
This issue appeared on SQLModel 0.0.14.
All reactions