$npx skillfedfor your agent

casbin-async-sqlalchemy-adapter

Asynchronous SQLAlchemy Adapter for PyCasbin

Worth itPyPI DatabaseReleased Dec 2025139.9K downloads / moApache-2.0Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — casbin_async_sqlalchemy_adapter-1.17.0-py3-none-any.whl
v1.17.0 · released 2025-12-10 · Python >=3.7 · 2 runtime deps: SQLAlchemy, pycasbin

Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and a permissive license. Install it if you need to persist Casbin policies in a database and are already using async SQLAlchemy; it is the standard adapter for that use case. Not necessary if you store policies in files or memory.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires an async-compatible SQLAlchemy driver (e.g., aiosqlite for SQLite, aiomysql for MySQL) and a Casbin model configuration file.
  • Low friction: pure Python wheel with only two runtime dependencies (SQLAlchemy and pycasbin).
  • Active maintenance with a recent release (2025-12-10) and commits as of 2026-08-06.

License · maintenance · safety

Apache-2.0 (permissive) — Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you must include a copy of the license and note any modifications.

last release 2025-12-10 (247 days) · last repo commit 2026-08-06 · 6 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 139,864 downloads/mo, #11,286 on PyPI

Verify before relying

pip install casbin-async-sqlalchemy-adapter

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)

if e.enforce("alice", "data1", "read"):
    # permit alice to read data1
    pass
  • Whether the adapter's soft-deletion and Alembic integration features are production-tested or primarily documented examples.
  • Performance characteristics when handling large policy datasets or high-concurrency access patterns.
  • Whether external session management is required for optimal transaction control in production deployments.
Same gist for agents: .md · .json

What it is and what it does

This package bridges PyCasbin's access-control enforcement engine with SQLAlchemy's async ORM, allowing you to store and retrieve authorization policies from a database instead of keeping them in memory or configuration files. It wraps SQLAlchemy's async session management to handle policy persistence transparently, supporting multiple database backends (PostgreSQL, MySQL, SQLite, Oracle, SQL Server, MariaDB, Firebird) through SQLAlchemy's driver ecosystem.

You define your access-control model in a Casbin configuration file, then use this adapter to load policies from a database table and save policy changes back to it. The adapter integrates with async/await workflows, making it suitable for async web frameworks and services. It also supports advanced features like soft deletion (marking records as deleted rather than removing them), external session management for transaction control, and Alembic migration integration for schema management.

Use it for

  • Store RBAC (role-based access control) policies in PostgreSQL or MySQL for a web service, loading them at startup and updating them dynamically.
  • Implement soft-deleted audit trails of permission changes by marking policy records as deleted instead of removing them permanently.
  • Manage complex ABAC (attribute-based access control) rules in SQLite for a desktop or embedded application with async policy enforcement.
  • Integrate policy persistence into an existing Alembic migration workflow to version-control Casbin rule schema changes.
  • Use externally managed SQLAlchemy sessions to coordinate policy updates with other database transactions in a single atomic operation.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

The package is actively maintained, has no known vulnerabilities, low install friction, and a permissive license. Install it if you need to persist Casbin policies in a database and are already using async SQLAlchemy; it is the standard adapter for that use case. Not necessary if you store policies in files or memory.

Install

casbin-async-sqlalchemy-adapter on PyPI

Before you install

Low friction: pure Python wheel with only two runtime dependencies (SQLAlchemy and pycasbin). Active maintenance with a recent release (2025-12-10) and commits as of 2026-08-06.

Requires an async-compatible SQLAlchemy driver (e.g., aiosqlite for SQLite, aiomysql for MySQL) and a Casbin model configuration file.

License in practice

Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you must include a copy of the license and note any modifications.

Quickstart

pip install casbin-async-sqlalchemy-adapter

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)

if e.enforce("alice", "data1", "read"):
    # permit alice to read data1
    pass

Verify before relying

  • Whether the adapter's soft-deletion and Alembic integration features are production-tested or primarily documented examples.
  • Performance characteristics when handling large policy datasets or high-concurrency access patterns.
  • Whether external session management is required for optimal transaction control in production deployments.

Package facts

LicenseApache-2.0 permissive
Python supportSupports the current Python release >=3.7
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
SQLAlchemypycasbin
MaintenanceActively maintained 247 days since the last release
Last repo commit
First released
Downloads139,864 / month, #11,286 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
License :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9

Evidence: casbin_async_sqlalchemy_adapter-1.17.0-py3-none-any.whl

Tags

Capabilities
async casbin sqlalchemy adapterpolicy storage databaserbac access controlasync permission managementcasbin policy persistencesqlalchemy async adapteracl abac enforcement
Topics
access-controlasync-ormpolicy-engine
PyPI keywords
asynccasbinSQLAlchemycasbin-adapterrbacaccess controlabacaclpermission

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “async casbin sqlalchemy adapter”

Give your agent the search over MCP, or paste the wish link into any chat.

More Database packages

psycopg2-binary Worth it
PyPI · Software Development · released Apr 2026

psycopg2-binary is a PostgreSQL database adapter for Python that implements the DB API 2.0 specification, enabling Python applications to connect to and query PostgreSQL databases with thread-safe concurrent operations.

copyleftcompiled wheel · 3.9+
271.6Mdownloads / mo
redis Worth it
PyPI · Database · released Jul 2026

Python client library for connecting to and executing commands against Redis key-value stores, supporting both synchronous and asynchronous operations.

Install it if your application needs to interact with Redis; the only prerequisite is a running Redis server instance.

MITpure Python · 3.10+
268.3Mdownloads / mo
ydb Worth it
PyPI · Database · released Jul 2026

YDB Python SDK is the official client library for connecting to and querying YDB databases from Python applications.

Install it if you need to connect Python applications to YDB databases.

permissive licensepure Python · 3.10+
210.0Mdownloads / mo
snowflake-connector-python Worth it
PyPI · Software Development · released Aug 2026

Connects Python applications to Snowflake data warehouses using the DB API 2.0 specification, enabling SQL queries, data transfers, and warehouse operations.

Apache-2.0compiled wheel · 3.10+
193.6Mdownloads / mo
sqlparse Worth it
PyPI · Software Development · released Aug 2026

sqlparse tokenizes SQL text into a tree of statements, clauses, and expressions, and provides functions to split scripts, format queries, and inspect parsed tokens without validating dialect or syntax.

Install it if you need to manipulate, format, or analyze SQL text programmatically.

BSD-3-Clausepure Python · 3.10+
148.9Mdownloads / mo
dbt-adapters With conditions
PyPI · Database · released Jul 2026

Provides base adapter protocols and shared functionality that database adapters use to integrate with dbt-core, handling connections, dialect translation, relation caching, and core interface management.

Apache-2.0pure Python · 3.10.0+
121.3Mdownloads / mo

See also casbin-sqlalchemy-adapter · sqlalchemy-adapter · cerbos-sqlalchemy · casbin · pycasbin · fastcrud · databases · sqlalchemy-cockroachdb · advanced-alchemy · dbfread