$npx skillfedfor your agent

casbin-sqlalchemy-adapter

SQLAlchemy Adapter for PyCasbin

With conditionsPyPI DatabaseReleased Jul 2024400.7K downloads / moApache 2.0Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — casbin_sqlalchemy_adapter-1.4.0-py3-none-any.whl
v1.4.0 · released 2024-07-08 · Python >=3.3 · 2 runtime deps: casbin, SQLAlchemy

Yes, if you are already using PyCasbin and need to persist policies in a relational database. The low install friction, permissive license, and broad database support make it a straightforward choice for that use case. However, note that maintenance is dormant (no release in 767 days), so if you encounter bugs or need features, you may need to fork or patch it yourself. No known vulnerabilities as of the query date.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires a Casbin model configuration file (model.conf) defining your access control rules and a supported SQLAlchemy database connection string.
  • Low friction install with two runtime dependencies (casbin and SQLAlchemy).
  • Maintenance is dormant—last release was 767 days ago—but the repository remains active with a recent commit on 2024-07-08 and no archived status.

License · maintenance · safety

Apache 2.0 (permissive) — Licensed under Apache 2.0 (permissive), so you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

last release 2024-07-08 (767 days) · last repo commit 2024-07-08 · 82 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 400,666 downloads/mo, #6,936 on PyPI

Verify before relying

pip install casbin_sqlalchemy_adapter

import casbin_sqlalchemy_adapter
import casbin

adapter = casbin_sqlalchemy_adapter.Adapter('sqlite:///test.db')
e = casbin.Enforcer('path/to/model.conf', adapter)
if e.enforce("alice", "data1", "read"):
    # permit alice to read data1
    pass
  • Whether soft delete functionality works reliably with all supported database backends.
  • Performance characteristics when enforcing policies against large rule sets in production.
  • Compatibility with recent major versions of SQLAlchemy (1.4+) beyond what classifiers indicate.
Same gist for agents: .md · .json

What it is and what it does

This package bridges PyCasbin (a flexible access control library) and SQLAlchemy, letting you store and retrieve authorization policies in any database that SQLAlchemy supports. Instead of keeping policies in memory or in a static file, you define your access control model in Casbin's configuration format and let this adapter handle reading and writing rules to your database of choice—PostgreSQL, MySQL, SQLite, Oracle, SQL Server, Firebird, or Sybase.

You instantiate an Adapter with a database connection string, pass it to a Casbin Enforcer along with your model configuration, and then use Casbin's standard enforce() method to check whether a subject (user) can perform an action on an object (resource). The adapter also supports soft-delete semantics if you need to mark rules as deleted without removing them from the database, though you must implement the deletion timestamp logic yourself.

Use it for

  • Store RBAC (role-based access control) rules in PostgreSQL for a multi-tenant SaaS application where policies change frequently.
  • Persist ABAC (attribute-based access control) policies in SQLite for a desktop application that needs offline policy evaluation.
  • Load access control lists from an existing Oracle database to enforce fine-grained permissions in a legacy system migration.
  • Implement soft-delete auditing of permission changes by marking rules as deleted while preserving a historical record.
  • Centralize authorization policy management across microservices by storing all rules in a shared MySQL database.

Worth the install?

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

With conditions

Yes, if you are already using PyCasbin and need to persist policies in a relational database.

The low install friction, permissive license, and broad database support make it a straightforward choice for that use case. However, note that maintenance is dormant (no release in 767 days), so if you encounter bugs or need features, you may need to fork or patch it yourself. No known vulnerabilities as of the query date.

Install

casbin-sqlalchemy-adapter on PyPI

Before you install

Low friction install with two runtime dependencies (casbin and SQLAlchemy). Maintenance is dormant—last release was 767 days ago—but the repository remains active with a recent commit on 2024-07-08 and no archived status.

Requires a Casbin model configuration file (model.conf) defining your access control rules and a supported SQLAlchemy database connection string.

License in practice

Licensed under Apache 2.0 (permissive), so you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install casbin_sqlalchemy_adapter

import casbin_sqlalchemy_adapter
import casbin

adapter = casbin_sqlalchemy_adapter.Adapter('sqlite:///test.db')
e = casbin.Enforcer('path/to/model.conf', adapter)
if e.enforce("alice", "data1", "read"):
    # permit alice to read data1
    pass

Verify before relying

  • Whether soft delete functionality works reliably with all supported database backends.
  • Performance characteristics when enforcing policies against large rule sets in production.
  • Compatibility with recent major versions of SQLAlchemy (1.4+) beyond what classifiers indicate.

Package facts

LicenseApache 2.0 permissive
Python supportSupports the current Python release >=3.3
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
casbinSQLAlchemy
MaintenanceDormant 767 days since the last release
Last repo commit
First released
Downloads400,666 / month, #6,936 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_sqlalchemy_adapter-1.4.0-py3-none-any.whl

Tags

Capabilities
casbin sqlalchemy adapteraccess control policy databaserbac permission storagecasbin database backendpolicy persistence layersqlalchemy casbin integrationacl enforcement database
Topics
access-controlpolicy-storagerbac-abac
PyPI keywords
casbinSQLAlchemycasbin-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 › “rbac permission storage”

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-async-sqlalchemy-adapter · sqlalchemy-adapter · casbin · pycasbin · sqlalchemy-jdbcapi · sqlalchemy-firebird · cerbos-sqlalchemy · django-db-connection-pool · databases · fastapi-users-db-sqlalchemy