Get the mysql's tokens by the tool.
Project description
mysqltokenparser
A awesome tool that easy to get MySQL’s tokens.
Free software: MIT license
Documentation: https://mysqltokenparser.readthedocs.io.
Quickstart
0x01 安装
pip install mysqltokenparser
0x02 使用教程
import mysqltokenparser as mtp
sql = u"""
CREATE TABLE `aaa`.`t_zcm_operation_luck_award_record` (
`id` bigint(20) NOT NULL,
`operation_seq` varchar(30) NOT NULL,
`award_user_id` bigint(20) NOT NULL,
`award_type` int(11) DEFAULT NULL,
`award_id` varchar(40) DEFAULT NULL UNIQUE KEY,
`award_content` varchar(20) DEFAULT NULL,
`award_reason` varchar(30) DEFAULT NULL,
`award_source` int(11) DEFAULT NULL,
`state` tinyint(4) NOT NULL PRIMARY KEY,
`addtime` datetime NOT NULL,
`updatetime` datetime NOT NULL,
`ip` varchar(50) DEFAULT NULL,
`imei` varchar(50) DEFAULT NULL,
`intext` int(11) DEFAULT NULL,
`longext` bigint(20) DEFAULT NULL,
`strext` varchar(200) DEFAULT NULL,
PRIMARY KEY (id),
UNIQUE KEY `idx_op_seq_uid_type` (`operation_seq`,`award_user_id`,`award_type`),
KEY `idx_op_uid_type` (`award_user_id`,`award_type`),
KEY `idx_op_uid_sss` (longext(10))
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
"""
token_obj = mtp.mysql_token_parser(sql)
tokens = token_obj.get_tokens()
print tokens
# {
# 'uniquekey': ['award_id'],
# 'columnnames': [u'id', u'operation_seq', u'award_user_id', u'award_type', u'award_id', u'award_content', u'award_reason', u'award_source', u'state', u'addtime', u'updatetime', u'ip', u'imei', u'intext', u'longext', u'strext'],
# 'tablenames': [u'aaa.t_zcm_operation_luck_award_record'],
# 'sqltype': ['ddl'],
# 'primarykey': ['state'],
# 'indexnames': [u'id', u'operation_seq,award_user_id,award_type', u'award_user_id,award_type', u'longext(10)']
# }
Features
TODO
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2019-07-08)
First release on PyPI.
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
mysqltokenparser-1.0.0.tar.gz
(399.7 kB
view hashes)
Built Distribution
Close
Hashes for mysqltokenparser-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc9e7c128e8703628839e302ffcd5797741bd1bfa832f0a769d7dce44e85754e |
|
MD5 | 3139409664d7591b00db9bc38f944383 |
|
BLAKE2b-256 | 1218692c7462333e869be8cf9ffbd224a91ca048e4261d35fd5d0c60392e9efe |