mysqltokenparser

Get the mysql's tokens by the tool.


Keywords
mysqltokenparser, mysql, parser, python, token
License
MIT
Install
pip install mysqltokenparser==1.0.0

Documentation

mysqltokenparser

Documentation Status Updates

A awesome tool that easy to get MySQL's tokens.

Quickstart

0x01 Inistall

pip install mysqltokenparser

0x02 Tutorial

  • The library is so simple.
  • All types of SQL have different keys that are easy to identify.
  • And then You need to explore it.
import mysqltokenparser as mtp

sql = u"""
    ALTER TABLE t_a_gun2_6_dw_pfm_emp_cm ADD INDEX idx_eob_date(empid_org_bus (200),pfm_date);
"""

tokens = mtp.mysql_token_parser(sql)
print tokens
#{
#    "type": "ddl",
#    "data": {
#        "type": "altertable",
#        "data": {
#            "tablename": "t_a_gun2_6_dw_pfm_emp_cm",
#            "alter_data": [{
#                "type": "addindex",
#                "data": {
#                    "indexdefinition": {
#                        "columnnames": ["empid_org_bus", "pfm_date"]
#                    },
#                    "indexname": "idx_eob_date"
#                }
#            }]
#        }
#    }
#}

Features

  • Current version only support DDL(CREATE table, ALTER table), DML(simple SELECT, INSERT, DELETE, UPDATE).
  • TODO:SUPPORT MORE SQL STATEMENTS

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.