Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Parse PostgreSQL privileges

Project Description

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)

Authors

Documentation

For in-depth information, visit the documentation!

Development

pg_grant uses semantic versioning

Release History

This version
History Node

0.3.1

History Node

0.3.0

History Node

0.2.0.post0

History Node

0.2.0

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
pg_grant-0.3.1-py2.py3-none-any.whl
(21.5 kB) Copy SHA256 Hash SHA256
Wheel py2.py3 Jan 17, 2018
pg_grant-0.3.1.tar.gz
(26.2 kB) Copy SHA256 Hash SHA256
Source None Jan 17, 2018

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting