Closed 66dexmg closed 2 years ago
Hi @66dexmg π
Do you get a specific error when doing this?
@frankie567 Yes,it may be a small mistake.In next row,i can only get first post which was not the post i updated because the function 'execute' always return the number 1.
You're perfectly right @66dexmg, that's actually quite a dumb mistake from my part. You can find the correct, fixed code here: https://github.com/PacktPublishing/Building-Data-Science-Applications-with-FastAPI/commit/e95e35f484809e937071e45a3c1f6fcab83fd8f7
I'll now contact Packt to coordinate a proper erratum. Thank you for raising this π
@frankie567 You are welcome.You have written a fantastic book although I had waitted its Chinese translation for a long timeπ.Any oriented advice for me after I finish it?
Thanks!
Well, my main advice to fellow developers is usually: practice. It's by experimenting a lot, building new things, observe what others are doing in their code that you'll make progress and gain experience.
That said, there are a few subjects I didn't have the opportunity to show in the book that are interesting:
Thanks a lot!
https://github.com/PacktPublishing/Building-Data-Science-Applications-with-FastAPI/blob/da186755fba69a56917a222caa19661a8c19fc8b/chapter6/sqlalchemy/app.py#L91 I have tried in my code.Maybe the method 'execute' for 'update' return influenced rows not the primary-key id.And I know that in the 'insert' condition new id was returned. So maybe 'post.id' should be the parameter instead of 'post_id' in next function.