$npx skillfedfor your agent

sqlalchemy-adapter

SQLAlchemy Adapter for PyCasbin

With conditionsPyPI DatabaseReleased Nov 20251.8M downloads / moApache 2.0Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — sqlalchemy_adapter-1.9.0-py3-none-any.whl
v1.9.0 · released 2025-11-17 · Python >=3.3 · 2 runtime deps: pycasbin, SQLAlchemy

Yes, if you need to persist pycasbin policies in a relational database. The package is actively maintained, has no known vulnerabilities, and low install friction. It is a straightforward adapter with a narrow, well-defined scope—use it when pycasbin and SQLAlchemy are your architecture; do not install it if you are not already using pycasbin.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires a pycasbin model configuration file and an existing or creatable database at the connection string URL.
  • Low install friction; pure Python wheel with two runtime dependencies (pycasbin and SQLAlchemy).
  • Actively maintained with recent commits and no known vulnerabilities.

License · maintenance · safety

Apache 2.0 (permissive) — Apache 2.0 permissive license allows commercial and private use with minimal restrictions; attribution required but no copyleft obligations.

last release 2025-11-17 (270 days) · last repo commit 2026-05-15 · 7 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,782,012 downloads/mo, #3,567 on PyPI

Verify before relying

pip install sqlalchemy-adapter

import sqlalchemy_adapter

adapter = sqlalchemy_adapter.Adapter('sqlite:///test.db')
# Pass adapter to pycasbin Enforcer with model config file
# Then use Enforcer to check permissions
  • Whether the adapter supports all SQLAlchemy dialects equally or has known limitations with specific databases.
  • Performance characteristics and scalability limits when handling large policy rule sets.
  • Backward compatibility guarantees across major version updates.
Same gist for agents: .md · .json

What it is and what it does

This package acts as a bridge between pycasbin (a policy enforcement library) and any database that SQLAlchemy supports. Instead of storing access-control policies in memory or flat files, you point it at a database connection string, and it handles loading and saving policy rules to a database table. The adapter automatically creates the necessary schema on first use (unless you disable it), and works transparently with pycasbin's Enforcer to persist role-based access control (RBAC), attribute-based access control (ABAC), and access control list (ACL) policies.

Typical usage involves creating an Adapter with a database URL, passing it to a pycasbin Enforcer along with a policy model file, and then using the Enforcer to check permissions. The adapter manages the database interaction; you focus on policy rules and enforcement logic. It supports custom table names and can be configured to skip automatic table creation if your schema is managed separately.

Use it for

  • Store and load RBAC policies for a multi-tenant application across application restarts.
  • Manage ACL rules in a centralized database so multiple service instances enforce the same permissions.
  • Persist dynamic policy changes made at runtime without redeploying or restarting the application.
  • Migrate access-control policies between different database backends using SQLAlchemy's dialect abstraction.
  • Integrate pycasbin policy enforcement into an existing application that already uses SQLAlchemy for data access.

Worth the install?

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

With conditions

Yes, if you need to persist pycasbin policies in a relational database.

The package is actively maintained, has no known vulnerabilities, and low install friction. It is a straightforward adapter with a narrow, well-defined scope—use it when pycasbin and SQLAlchemy are your architecture; do not install it if you are not already using pycasbin.

Install

sqlalchemy-adapter on PyPI

Before you install

Low install friction; pure Python wheel with two runtime dependencies (pycasbin and SQLAlchemy). Actively maintained with recent commits and no known vulnerabilities.

Requires a pycasbin model configuration file and an existing or creatable database at the connection string URL.

License in practice

Apache 2.0 permissive license allows commercial and private use with minimal restrictions; attribution required but no copyleft obligations.

Quickstart

pip install sqlalchemy-adapter

import sqlalchemy_adapter

adapter = sqlalchemy_adapter.Adapter('sqlite:///test.db')
# Pass adapter to pycasbin Enforcer with model config file
# Then use Enforcer to check permissions

Verify before relying

  • Whether the adapter supports all SQLAlchemy dialects equally or has known limitations with specific databases.
  • Performance characteristics and scalability limits when handling large policy rule sets.
  • Backward compatibility guarantees across major version updates.

Package facts

LicenseApache 2.0 permissive
Python supportSupports the current Python release >=3.3
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
pycasbinSQLAlchemy
MaintenanceActively maintained 270 days since the last release
Last repo commit
First released
Downloads1,782,012 / month, #3,567 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: sqlalchemy_adapter-1.9.0-py3-none-any.whl

Tags

Capabilities
casbin sqlalchemy adapterpycasbin database persistencerbac policy storageaccess control databasecasbin policy adaptersqlalchemy casbin integrationacl enforcement database
Topics
access-controlpolicy-persistencerbac
PyPI keywords
pycasbincasbinSQLAlchemycasbin-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 › “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-async-sqlalchemy-adapter · casbin-sqlalchemy-adapter · casbin · pycasbin · cerbos-sqlalchemy · fastapi-users-db-sqlalchemy · sqlalchemy-firebird · sqlalchemy-jdbcapi · sqlalchemy-ibmi · databases