Need a python 2.7 script - using pyparsing module to scan mysql source files.
Those Mysql files may containing multiple SQLs statements and comments.
The coding style can be different, the only assumption is that the developers of those scripts tried to make it compatible
with mysql ,
Pyparsing script needs to detect:
1. if there is more than one SQLs statement in the script.
2. find all ALTER table statements and parse those all
'alter table' statements
to detect a) database name ,
b) table name
c) and the the rest of the alter table statement, so it can be passed to percona online tool - hope you know what I am talking about. if not - google it.
IMPORTANT: parsing script must handle correctly:
- commented out statements , including multi-line comments - ignoring all commented out sqls .
- single quoted and double quoted scripts - potentially containing SQL delimiter chars - and do not stop/break
when a SQL delimiter char is in the comments or in the quoted stings
- handle different styles of specifying database , table , column names - with or without backtick qoutes and a mix of those naming styles in the same script
- detect delimiter change.
- detect missing delimiter at the end of the script and in case of multiple SQLs also detect missing delimiter in between SQls.
- handle well complex cases like when alter table sqls can have add column clause with comments on the column potentially containing characters which is a current delimiter
- I prefer to work with people who pays attention to small details , so I will ignore all bidders who will not copy/paste the phrase:
'I understood that I need to handle complex cases' as a first line in reply to me.
and I really mean it.
Here are several examples :
this should be ignored
alter table [url removed, login to view] add colum a int;
-- watch out for the semicol ";" char in the quoted string below:
alter table [url removed, login to view]
ADD COLUMN is_cancelable TINYINT NOT NULL DEFAULT 0
COMMENT '0 = non-cancelable; 1 = cancelable; 2 = flexible' AFTER cancellation_id;
alter table `testdb`.new_sales CHANGE IsDeleted IsDeleted tinyint(1) NOT NULL;
--------- WHAT”S NEXT: ———
Stretch goal (Phase II ) - which could be a part of this project
or filed and as a separated project assigned to the same bidder
after the above it done and accepted :
- 3 Detect if there is any syntax error mysql ( 5.6/5.7 grammar )
-4 classify if the script is DML only or a mix of DML, DDL , grants , etc
d) get the list of would be altered tables.
e)get the list of tables receiving inserts
f)get the list of tables receiving updates
g) get the list of tables receiving deletes
h) and estimate the number of affected records for DML without running DMLs
clarification: "in reply to me" means "in the proposal text"
20 freelanceria on tarjonnut keskimäärin 179 $ tähän työhön
data extraction from sql database scripts Relevant Skills and Experience python sql machine learning data science software architecture algorithm Proposed Milestones $166 USD - final
a python script - using pyparsing to scan MySql sql files. Relevant Skills and Experience MySQL, Python Proposed Milestones $155 USD - a python script - using pyparsing to scan MySql sql files.