Skip to content

teamable-software/django-postgresql-setrole

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started

django-postgresql-setrole module sets SET ROLE statement in every connection to Postgres. This module is a good solution in case you have more than one user(role) in your database and they all do read/write operations in the same database. In postgres role inheritance is one directional and Postgres will not let you set up circular membership loops. Learn more about role inheritance constraints in Postgres here So not have conflict it is a good practice to have one role lets say ROLE_A and the rest inherit the rights of ROLE_A and in case there is a need to create new object in db it should be done as ROLE_A. In postgres it can be done using SET ROLE command unless we don't want to have a database and a lot of ownerships in it (different tables with different owners etc.).

Prerequisites

Python 2.7.*

Installing

  1. Add postgresql_setrole to INSTALLED_APPS
  2. Add SET_ROLE in your database connection. E.g.
    "default": {
        ...,  # other settings
        "SET_ROLE": "owner",
    }.
}

Licence

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

Feel free to contact us and share your experience.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages