Uh oh!
There was an error while loading. Please reload this page.
🐛 Fix AsyncSession type annotations for exec() - #58
Conversation
894c60d to
8d578a9CompareBobronium
commented
Jun 30, 2022
priyansh-anand
commented
Jul 17, 2022
Thanks for the feature! Until this PR gets merged, manually patching will work for my workflow. |
📝 Docs preview for commit 11ff44f at: https://639cfc052b35ad15e2e48091--sqlmodel.netlify.app |
@tiangolo, I can try to resolve CI issues and update the branch, but I need a confirmation that you have intention of merging it once issues are resolved and willing to communicate if I'll need any feedback on resolving them. Complete lack of comminucation from your side on this issue is frustrating. I don't want to waste any more time on this PR only to find it in the same condition a year later. |
maresb
commented
Feb 15, 2023
Thanks @Bobronium for the fix, I am pip installing your branch instead of v0.0.8. I hope this gets merged soon. |
diego-escobedo
commented
May 18, 2023
Crazy this has been around since 2021. Awesome work @Bobronium on this. |
The whole point of SQLModel is that it returns typed objects that play nice with Pydantic and allow your editor's autocomplete functions to work properly. Except when you're using `sqlalchemy.AsyncSession`, it... doesn't. And there *is* a `sqlmodel.AsyncSession`, but it's broken. And there is a *fix* for it in an upstream PR, but it's not merged yet. fastapi/sqlmodel#58 This PR just copies and uses the upstream PR implementation of `sqlmodel.AsyncSession`. Most of the actual diff here is related to the side-benefit that we no longer have to unwrap the row-tuples that `sqlalchemy.execute` returns, but most of the actual benefit for doing this is that we'll now actually get our appropriately-typed model objects back out of `session.exec` instead of `Any`. Related work items: #15767106
ornakash
commented
Oct 12, 2023
Please merge this? |
Bobronium
commented
Oct 12, 2023
@tiangolo, I've fixed CI issue. Tests are passing now. Please merge. |
tiangolo
commented
Oct 23, 2023
Great, thanks @Bobronium! 🚀 Thanks everyone for the comments, in particular confirming this solved it for you. 🍰 Thanks for the patience everyone! This will be available in the next version, |
AsyncSession type annotations for exec()# What This updates SQLModel to version 0.0.11, which solves an [issue](fastapi/sqlmodel#443) with foreign key declaration, and another [issue](fastapi/sqlmodel#58) with AsyncSession type annotations. # Why Prior to this update, attempting to delete a document with an associated index record would throw a foreign key violation error. # Test plan Add a document which results in an index record being created. Delete the same document and verify that - The document is deleted without error - The index records associated with the document are also deleted
Fixes#54
hero.py:Running on main
Running on Bobronium:AsyncSession_typing_fix: