Skip to main content

parse MySQL SHOW GRANTS.

Project description

Build Status

NAME

mysql_grantparser - parse MySQL SHOW GRANTS

SYNOPSIS

import mysql_grantparser

grants = mysql_grantparser.Exporter(
    host='127.0.0.1',
    port=3306,
    user='root',
    password='pa55w0rd',
).export()

DESCRIPTION

mysql_grantparser is SHOW GRANTS parser for MySQL, inspired by Ruby's Gratan.

This module returns privileges for all users as following dict.

{
    'USER@HOST': {
        'user': USER,
        'host': HOST,
        'objects': {
            'DB_NAME.TABLE_NAME': {
                'privs': [ PRIV_TYPE, PRIV_TYPE, ... ],
                'with': 'GRANT OPTION',
            },
            ...
        },
        'options': {
            'identified': '...',
            'required': '...',
        },
    },
    ...
}

For example, this GRANT statement

GRANT SELECT, INSERT, UPDATE, DELETE ON orcl.* TO 'scott'@'%' IDENTIFIED BY 'tiger' WITH GRANT OPTION;

is represented as following.

{
    'scott@%': {
        'user': 'scott',
        'host': '%',
        'objects': {
            '*.*': {
                privs: [
                    'USAGE'
                ],
            },
            'orcl.*': {
                'privs': [
                    'SELECT',
                    'INSERT',
                    'UPDATE',
                    'DELETE',
                ],
                'with': 'GRANT OPTION',
            }
        },
        'options': {
            'identified': "PASSWORD XXX",
        },
    },
}

SEE ALSO

Project details


Download files

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

Source Distribution

mysql-grantparser-1.0.5.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

mysql_grantparser-1.0.5-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file mysql-grantparser-1.0.5.tar.gz.

File metadata

  • Download URL: mysql-grantparser-1.0.5.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.3

File hashes

Hashes for mysql-grantparser-1.0.5.tar.gz
Algorithm Hash digest
SHA256 f26665a0f3e1c9790c8f2d0547377cada59fb4d3078e33d43fb0de8b4f1143f3
MD5 ef3c49ef51d340a6b940a7adb6e3f565
BLAKE2b-256 674c6569e5b8ea62d4f28c5be5ebe4ebf3438cbe958d59cf29170105d3f09d6f

See more details on using hashes here.

File details

Details for the file mysql_grantparser-1.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for mysql_grantparser-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f5137b23606402ef809249324561f73d3f7033ffce314515c181bf7b2822a9ba
MD5 db3430f75182868994fb503bcc0c1794
BLAKE2b-256 f91df1d29cf87ddc08669552bc51bdd5b98c59f630f3920b29dfa6a1fcd3431c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page