oso
                                
                                
                                
                                    oso copied to clipboard
                            
                            
                            
                        [POC] Added Support for AsyncSession in SQLAlchemy 1.4+
Im adding a PoC for AsyncSession support in the latest sqlalchemy-oso module.
2 functions are added: authorized_async_sessionmaker and async_scoped_session, both are expecting AsyncSessions as opposed to normal Session.
SQLAlchemy converts all code to Sync when time comes to process signals so there shouldn't be a need for any modifications there. I have tested with the following code from your tutorial and got the expected output:
https://gist.github.com/zikphil/9b0c7d70b789796bcbcc56528e41ea51
Feel free to adapt this code as you see fit.
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅
I have read the CLA Document and I hereby sign the CLA
Hi @zikphil thanks for the contribution! I'm sorry it's taken us a few days to get to it — we've been pretty heads-down on getting ready for tomorrow's release. I'll make sure this PR gets reviewed ASAP
Please review the new implementation. I have split it out in separate files and added a condition for SQLAlchemy => 1.4
Hi @zikphil - do you have a chance to move forward with this PR? We had used it with a handful of calls so far and it worked fine, would be great to have it operating on top of oso 0.26.0   😇