sqlmodel icon indicating copy to clipboard operation
sqlmodel copied to clipboard

Supporting pydantic custom root models as columns

Open 5cat opened this issue 4 years ago • 3 comments

Resolves #7

the approach was to wrap the model around a custom type similar to the SQLAlchemy documentation example .

although i thought about using hypothesis but it will introduce another dependency so i just typed arbitrary values for the tests since i didnt care about the individual values but their types.

So now it is possible to use pydantic custom root type models as column types.

there are some types that do not work with sqlite so i made pytest skip them

5cat avatar Nov 27 '21 12:11 5cat

Status on the merge of this? It's quite crucial.

Fanna1119 avatar Feb 18 '22 12:02 Fanna1119

Status on the merge of this? It's quite crucial.

I figure a good strategy now is to just merge what you need in your own fork. I suppose tiangolo checks these when he has time, but there's a long list so I wouldn't wait with anything crucial.

antont avatar Feb 18 '22 14:02 antont

Thanks @5cat and everyone, let's switch first to the discussion in https://github.com/tiangolo/sqlmodel/issues/7, I need to understand the use case and why this would be needed/wanted.

tiangolo avatar Oct 26 '23 10:10 tiangolo