Git Product home page Git Product logo

Comments (4)

art049 avatar art049 commented on June 12, 2024 3

Might be related to pydantic/pydantic#8362
Edit: it is

from odmantic.

laveolus avatar laveolus commented on June 12, 2024

because of the new_root hack in validate_type (it aliases all field types), this problem pops up for any Model with more than 1 Union/Optional field.

from odmantic.

anentropic avatar anentropic commented on June 12, 2024

oh wow... I had this with an Optional[datetime] field and thought it was probably because PyMongo already fetched mongo Date as Python datetime and then Pydantic was expecting to deserialize JSON. I was wondering if maybe odmantic can only read data that it wrote itself (i.e. if it was inserting dates as strings to the db)

but it seems like it's actually just this bug, as I also had a couple of Optional[str] fields on the model... and either removing them or making my date field non-optional allows to parse a row successfully (but then the model is no longer usable for my app)

this fix here #416 works for me 👍

from odmantic.

art049 avatar art049 commented on June 12, 2024

Yes, this is fixed by #416. Amazing job @netomi!

from odmantic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.