pg_grant is a Python module for parsing, querying, and updating PostgreSQL privileges.
Installation
$ pip install pg_grant[sqlalchemy]
Without the SQLAlchemy extra, pg_grant can only parse access privileges.
Example
>>> from pg_grant import parse_acl_item
>>> parse_acl_item('bob=arw*/alice')
Privileges(grantee='bob', grantor='alice', privs=['SELECT', 'INSERT'], privswgo=['UPDATE'])
>>> from sqlalchemy import create_engine
>>> from pg_grant.query import get_table_acl
>>> engine = create_engine('postgresql://...')
>>> get_table_acl(engine, 'table2')
SchemaRelationInfo(oid=138067, name='table2', owner='alice', acl=['alice=arwdDxt/alice', 'bob=arwdDxt/alice'], schema='public')
>>> from pg_grant import PgObjectType
>>> from pg_grant.sql import revoke
>>> stmt = revoke(['SELECT'], PgObjectType.TABLE, 'table2', 'bob')
>>> str(stmt)
'REVOKE SELECT ON TABLE table2 FROM bob'
>>> engine.execute(stmt)
Documentation
For in-depth information, visit the documentation!
Development
pg_grant uses semantic versioning
Metadata
Release files for pg-grant 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pg_grant-0.4.0.tar.gz | 29.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pg_grant-0.4.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 49.4 kB
Release files / pg_grant-0.4.0.tar.gz
| Download URL | pg_grant-0.4.0.tar.gz |
|---|---|
| Size | 29.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1dd86acfd55e02e20d22fed50b9c39ce2dfa7f11d26c575658b49f06155348d4
|
|
BLAKE2b-256 checksum How to use checksums |
ad43bf438f7bea4b587d08fd6a9b0048d287617b3b1133422f5950175f0138e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Release files / pg_grant-0.4.0-py2.py3-none-any.whl
| Download URL | pg_grant-0.4.0-py2.py3-none-any.whl |
|---|---|
| Size | 20.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
a8ce43af0bf2775bca882739b46300bcd3d283914266410779e14c79dda92206
|
|
BLAKE2b-256 checksum How to use checksums |
b1f65fb9696cf942f67f0abf9c3efe2b64a90e871cd75449bb7b4c5c8d5f12f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|