Hey there ๐
litestar pulls the advanced_alchemy package which I use to retrieve my session in another layer than the route functions using get_session()
Though i'm not so sure how to deal with nested transaction with it. Not the best place to ask for help since it's SQLAlchemy focus, let me know if i should move it.
You can check the code on the screen capture I linked.
So create_account is called from the POST route and use the session using get_session().
create_account calls create_token which retrieves the session and commit a new token associated with the new account.
After creating and committing the token, the account is committed.
I want to ensure that my token creation is rollbacked when an error happens in the create_account function or even better in the route calling create_account.
I read the SQLAlchemy documentation which say to use begin_nested but I also read on other place that you shouldn't deal with this when using get_session so i'm a bit confused now. Could someone help on that ?
Thanks ๐