https://github.com/shimizukawa/django-pg-rls
django + postgres + rls
https://github.com/shimizukawa/django-pg-rls
django multitenant postgres rls
Last synced: 7 months ago
JSON representation
django + postgres + rls
- Host: GitHub
- URL: https://github.com/shimizukawa/django-pg-rls
- Owner: shimizukawa
- Created: 2021-04-22T15:40:38.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-07-01T21:06:04.000Z (over 4 years ago)
- Last Synced: 2025-03-25T11:22:01.665Z (7 months ago)
- Topics: django, multitenant, postgres, rls
- Language: Python
- Homepage: https://scrapbox.io/shimizukawa/Django_PG_RLS
- Size: 24.4 KB
- Stars: 13
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Django Postgres Row-Level-Security
==================================
Building multi-tenant application with using database "shared" pattern.
## Concepts
* Avoid multiple schema/database for high-performance.
* Protecting data from other tenant.
references:
* https://pganalyze.com/blog/postgres-row-level-security-django-python
## Usage
### boot
```
$ docker-compose up
```
### DB migration
```
$ docker-compose exec dj python3 manage.py migrate
```
### access
* http://localhost:8000/admin/
* Tenant1: ID/PW: haru
* Tenant2: ID/PW: terada
* Admin: ID/PW: admin
### containers
* dj (django)
* http://localhost:8000/
* db (postgres)
* ID/password: `root`/`root`
### DB console
```
$ docker-compose exec db psql -U db
```