pg-grant


Namepg-grant JSON
Version 0.3.3 PyPI version JSON
download
home_pagehttps://github.com/RazerM/pg_grant
SummaryParse PostgreSQL privileges
upload_time2023-02-05 19:46:24
maintainer
docs_urlNone
authorFrazer McLean
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            pg_grant
-------------

|PyPI Version| |Documentation| |Travis| |Coverage| |Python Version| |PostgreSQL Version| |License|

``pg_grant`` is a Python module for parsing, querying, and updating PostgreSQL
privileges.

Installation
~~~~~~~~~~~~

.. code:: bash

    $ pip install pg_grant[sqlalchemy]

Without the SQLAlchemy extra, ``pg_grant`` can only parse access privileges.

Example
~~~~~~~

.. code:: python

    >>> 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
~~~~~~~
- Frazer McLean <frazer@frazermclean.co.uk>

Documentation
~~~~~~~~~~~~~

For in-depth information, `visit the
documentation <http://pg_grant.readthedocs.org/en/latest/>`__!

Development
~~~~~~~~~~~

pg_grant uses `semantic versioning <http://semver.org>`__

.. |Travis| image:: http://img.shields.io/travis/RazerM/pg_grant/master.svg?style=flat-square&label=Travis
    :target: https://travis-ci.org/RazerM/pg_grant
.. |PyPI Version| image:: http://img.shields.io/pypi/v/pg_grant.svg?style=flat-square&label=PyPI
    :target: https://pypi.python.org/pypi/pg_grant/
.. |Python Version| image:: https://img.shields.io/badge/Python-3-brightgreen.svg?style=flat-square
    :target: https://www.python.org/downloads/
.. |PostgreSQL Version| image:: https://img.shields.io/badge/PostgreSQL-9.5--12-blue.svg?style=flat-square
    :target: https://www.postgresql.org/
.. |License| image:: https://img.shields.io/github/license/RazerM/pg_grant.svg?style=flat-square
    :target: https://raw.githubusercontent.com/RazerM/pg_grant/master/LICENSE.txt
.. |Coverage| image:: https://img.shields.io/codecov/c/github/RazerM/pg_grant/master.svg?style=flat-square
    :target: https://codecov.io/github/RazerM/pg_grant?branch=master
.. |Documentation| image:: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat-square
    :target: http://pg_grant.readthedocs.org/en/latest/

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/RazerM/pg_grant",
    "name": "pg-grant",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Frazer McLean",
    "author_email": "frazer@frazermclean.co.uk",
    "download_url": "https://files.pythonhosted.org/packages/fa/85/8c2beaba67a4444a867a71fd94b5454620af2a1c3c3901807ce863d9b60f/pg_grant-0.3.3.tar.gz",
    "platform": null,
    "description": "pg_grant\n-------------\n\n|PyPI Version| |Documentation| |Travis| |Coverage| |Python Version| |PostgreSQL Version| |License|\n\n``pg_grant`` is a Python module for parsing, querying, and updating PostgreSQL\nprivileges.\n\nInstallation\n~~~~~~~~~~~~\n\n.. code:: bash\n\n    $ pip install pg_grant[sqlalchemy]\n\nWithout the SQLAlchemy extra, ``pg_grant`` can only parse access privileges.\n\nExample\n~~~~~~~\n\n.. code:: python\n\n    >>> from pg_grant import parse_acl_item\n    >>> parse_acl_item('bob=arw*/alice')\n    Privileges(grantee='bob', grantor='alice', privs=['SELECT', 'INSERT'], privswgo=['UPDATE'])\n\n    >>> from sqlalchemy import create_engine\n    >>> from pg_grant.query import get_table_acl\n    >>> engine = create_engine('postgresql://...')\n    >>> get_table_acl(engine, 'table2')\n    SchemaRelationInfo(oid=138067, name='table2', owner='alice', acl=['alice=arwdDxt/alice', 'bob=arwdDxt/alice'], schema='public')\n\n    >>> from pg_grant import PgObjectType\n    >>> from pg_grant.sql import revoke\n    >>> stmt = revoke(['SELECT'], PgObjectType.TABLE, 'table2', 'bob')\n    >>> str(stmt)\n    'REVOKE SELECT ON TABLE table2 FROM bob'\n    >>> engine.execute(stmt)\n\nAuthors\n~~~~~~~\n- Frazer McLean <frazer@frazermclean.co.uk>\n\nDocumentation\n~~~~~~~~~~~~~\n\nFor in-depth information, `visit the\ndocumentation <http://pg_grant.readthedocs.org/en/latest/>`__!\n\nDevelopment\n~~~~~~~~~~~\n\npg_grant uses `semantic versioning <http://semver.org>`__\n\n.. |Travis| image:: http://img.shields.io/travis/RazerM/pg_grant/master.svg?style=flat-square&label=Travis\n    :target: https://travis-ci.org/RazerM/pg_grant\n.. |PyPI Version| image:: http://img.shields.io/pypi/v/pg_grant.svg?style=flat-square&label=PyPI\n    :target: https://pypi.python.org/pypi/pg_grant/\n.. |Python Version| image:: https://img.shields.io/badge/Python-3-brightgreen.svg?style=flat-square\n    :target: https://www.python.org/downloads/\n.. |PostgreSQL Version| image:: https://img.shields.io/badge/PostgreSQL-9.5--12-blue.svg?style=flat-square\n    :target: https://www.postgresql.org/\n.. |License| image:: https://img.shields.io/github/license/RazerM/pg_grant.svg?style=flat-square\n    :target: https://raw.githubusercontent.com/RazerM/pg_grant/master/LICENSE.txt\n.. |Coverage| image:: https://img.shields.io/codecov/c/github/RazerM/pg_grant/master.svg?style=flat-square\n    :target: https://codecov.io/github/RazerM/pg_grant?branch=master\n.. |Documentation| image:: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat-square\n    :target: http://pg_grant.readthedocs.org/en/latest/\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Parse PostgreSQL privileges",
    "version": "0.3.3",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4613ed3be7b0692b36c63f417c08dbec4c17904f5f279bf58c74f22ac19d33c1",
                "md5": "2ee61c27e739354be7724cbcfcfc533c",
                "sha256": "ceecee3da6e8282cf07b3088cc8e32927017545d8ce1cb53f328b7b70d5ec0c9"
            },
            "downloads": -1,
            "filename": "pg_grant-0.3.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2ee61c27e739354be7724cbcfcfc533c",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 20469,
            "upload_time": "2023-02-05T19:46:22",
            "upload_time_iso_8601": "2023-02-05T19:46:22.813951Z",
            "url": "https://files.pythonhosted.org/packages/46/13/ed3be7b0692b36c63f417c08dbec4c17904f5f279bf58c74f22ac19d33c1/pg_grant-0.3.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fa858c2beaba67a4444a867a71fd94b5454620af2a1c3c3901807ce863d9b60f",
                "md5": "fb22da002e2b68e0bda7982db7210e33",
                "sha256": "6207953eb42cffeb1b2b907b62fc59cff884beb0c3847c61415a1fc513c56fbe"
            },
            "downloads": -1,
            "filename": "pg_grant-0.3.3.tar.gz",
            "has_sig": false,
            "md5_digest": "fb22da002e2b68e0bda7982db7210e33",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 28922,
            "upload_time": "2023-02-05T19:46:24",
            "upload_time_iso_8601": "2023-02-05T19:46:24.966118Z",
            "url": "https://files.pythonhosted.org/packages/fa/85/8c2beaba67a4444a867a71fd94b5454620af2a1c3c3901807ce863d9b60f/pg_grant-0.3.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-05 19:46:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "RazerM",
    "github_project": "pg_grant",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "pg-grant"
}
        
Elapsed time: 0.03547s