async-sqlalchemy-adapter

Asynchronous SQLAlchemy Adapter is the SQLAlchemy adapter for PyCasbin. With this library, Casbin can load policy from SQLAlchemy supported database or save policy to it.
Based on Officially Supported Databases, The current supported databases are:
- PostgreSQL
- MySQL
- MariaDB
- SQLite
- Oracle
- Microsoft SQL Server
- Firebird
Installation
pip install casbin_async_sqlalchemy_adapter
Simple Example
import casbin_async_sqlalchemy_adapter
import casbin
adapter = casbin_async_sqlalchemy_adapter.Adapter('sqlite+aiosqlite:///test.db')
e = casbin.AsyncEnforcer('path/to/model.conf', adapter)
sub = "alice"
obj = "data1"
act = "read"
if e.enforce(sub, obj, act):
pass
else:
pass
Note that AsyncAdaper must be used for AynscEnforcer.
Getting Help
License
This project is licensed under the Apache 2.0 license.