Your Django ORM protects tenant data. Your raw SQL doesn't. π¬
That's why I built django-rls-tenants β multitenancy powered by PostgreSQL Row-Level Security, enforced at the database level.
π Every query is filtered β ORM, raw SQL, even dbshell
π« Missing tenant context? Zero rows returned, never a data leak
π¦ Single schema, no connection routing headaches
β‘ Drop-in: one base model, one middleware, done
Unlike schema-based or ORM-rewriting approaches, RLS policies live in PostgreSQL itself. The database becomes your last line of defense β not your app code.
Supports Python 3.11+, Django 4.2β6.0, PostgreSQL 15+.
Just shipped v1.0.0 π
pip install django-rls-tenants
π Docs & source: https://github.com/dvoraj75/django-rls-tenants
Feedback, stars & contributions welcome! β
#Django #Python #PostgreSQL #MultiTenancy #RowLevelSecurity #OpenSource #WebDev #SaaS #InfoSec #Database

GitHub - dvoraj75/django-rls-tenants: Database-enforced multitenancy for Django using PostgreSQL Row-Level Security. Every query -- ORM, raw SQL, dbshell -- is filtered by the database itself. Zero data leaks by design
Database-enforced multitenancy for Django using PostgreSQL Row-Level Security. Every query -- ORM, raw SQL, dbshell -- is filtered by the database itself. Zero data leaks by design - dvoraj75/djang...


