DEV Community

Cover image for Release0.3 Using PyParing lib in mindsdb
Tengzhen Zhao
Tengzhen Zhao

Posted on

Release0.3 Using PyParing lib in mindsdb

MindsDB is a predictive platform that makes databases intelligent and machine learning easy to use. It allows data analysts to build and visualize forecasts in BI dashboards without going through the complexity of ML pipelines, all through SQL. It also helps data scientists to streamline MLOps by providing advanced instruments for in-database machine learning and optimize ML workflows through a declarative JSON-AI syntax.
I did 3 issues of this project, 1773 and 1771 have merged, and 1777 had approved.

PR 1773 and PR1771 review

These two issues are easy to fix, but it can help me understand the program as soon as possible and let me establish good communication with the project owner.
The first issue need to find the integrations table file, and remove the supported integrations table.
Image description
The second issue is that rename two sections from the left navigation menu.
Image description

PR1777 review

The issue is that if the user adds the space in the integration name, the app isn't able to parse that for e.g My SQL

mysql> CREATE PREDICTOR home_rentals_model FROM `My SQL`(SELECT * from test_data.home_rentals)  PREDICT rental_price;
ERROR 1149 (HY000): Expected "PREDICT" (at char 45), (line:1, col:46)
mysql>
Enter fullscreen mode Exit fullscreen mode

At the beginning, I think the issue is from the interface, and I just need to remove the white space. Then I used the following code to deal with the issue.
Image description
After communicating with the project owner, I know that the interface changes affect only 'integration', ie when you work with MindsDB from your database (not via direct connection to MindsDB). In original issue error had raise in 'create predictor' query, which cant be used with such connection. The issue is parser error, probably it does not understand back quote symbols.
I searched for some information about pyparser and the pyparser can't understand backquotes as you said. Then I checked some methods about how to identify backquotes, probably two methods. One is to use backslash + backquote, and the other is to use repr (). I use the backslash +backquote method in this PR.
Image description

What I learned

The pyparsing module is an alternative approach to creating and executing simple grammars, vs. the traditional lex/yacc approach, or the use of regular expressions. The pyparsing module provides a library of classes that client code uses to construct the grammar directly in Python code. There are lots of functions, and I am learning them.

Discussion (0)