You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. I really liked this book, it gives a fresh (for me) perspective at coding a web application, and it looks fantastic, very well written, not too difficult to understand. I finished the part 1 a couple of hours ago, it turned my perspective upside down, and I decided to give my new knowledge a try, just writing a small web service. And I encountered a problem: if I want to use pydantic to write my domain models, when I apply the SQLAlchemy mapper on them, the models stop working, they simply throw error at initializing. I really love pydantic, but I also ain't sure it's worth implementing smth like in django appendix just because I wanna use pydantic insteadof dataclasses and just classes.
The error:
AttributeError: 'User' object has no attribute 'pydantic_private'. Did you mean: 'pydantic_complete'?
I would say - don't be afraid of boilerplate like this. a dumb function that maps a sqlalchemy row-dictionary to a pydantic class in a really mechanical way might feel really tedious and verbose, but it really isn't that much of a maintenance burden.
oh and also-by-the-way -- if you enjoyed the book, i don't suppose you'd have time to write a quick review online somewhere? on amazon or goodreads or wherever you like to put reviews? they really help 😊
oh and also-by-the-way -- if you enjoyed the book, i don't suppose you'd have time to write a quick review online somewhere? on amazon or goodreads or wherever you like to put reviews? they really help 😊
I'd be glad to leave a review everywhere I can, but I don't know where, could you give the urls?
Activity
hjwp commentedon Oct 10, 2024
I like pydantic too! but i've never tried it with the sqla mapper. maybe something more manual is the only way to go...
hjwp commentedon Oct 10, 2024
let me know if you find a good solution!
hjwp commentedon Oct 10, 2024
I would say - don't be afraid of boilerplate like this. a dumb function that maps a sqlalchemy row-dictionary to a pydantic class in a really mechanical way might feel really tedious and verbose, but it really isn't that much of a maintenance burden.
hjwp commentedon Oct 10, 2024
oh and also-by-the-way -- if you enjoyed the book, i don't suppose you'd have time to write a quick review online somewhere? on amazon or goodreads or wherever you like to put reviews? they really help 😊
drforse commentedon Oct 10, 2024
I'd be glad to leave a review everywhere I can, but I don't know where, could you give the urls?