@@ -8,7 +8,7 @@ Designed to be used in conjunction with [django-daiquri](https://github.com/djan
88as a query processing backend but it can be easily used as a stand-alone tool
99or integrated into another project.
1010
11- ** \* NOTE: Since version 0.7.0, MySQL is not activelly supported/ maintained anymore.**
11+ ** \* NOTE: Since version 0.7.0 MySQL is not supported ( maintained) anymore.**
1212
1313
1414[ ![ pytest Workflow Status] ( https://github.com/aipescience/queryparser/actions/workflows/pytest.yml/badge.svg )] ( https://github.com/aipescience/queryparser/actions/workflows/pytest.yml )
@@ -24,9 +24,7 @@ Installation
2424The easiest way to install the package is by using the pip tool:
2525
2626``` bash
27-
28- pip install queryparser-python3
29-
27+ python -m pip install queryparser-python3
3028```
3129
3230Alternatively, you can clone the repository and install it from there.
@@ -39,29 +37,35 @@ Generating the parser from the git repository
3937
4038To generate the parsers you need ` python3 ` , ` java ` above version
41397, and ` antlr4 ` (` antlr-4.*-complete.jar ` has to be installed inside the
42- ` /usr/local/lib/ ` or ` /usr/local/bin/ ` directories).
40+ ` /usr/local/lib/ ` , ` /usr/local/bin/ ` or root directory of the project).
41+
42+ The current version of ` antlr-4.*-complete.jar ` can be downloaded via
43+
44+ ``` bash
45+ wget http://www.antlr.org/download/antlr-4.13.1-complete.jar
46+ ```
4347
4448After cloning the project run
4549
4650``` bash
47- make
51+ make
4852```
4953
5054and a ` lib ` directory will be created. After that, run
5155
5256``` bash
53- python setup.py install
57+ python -m pip install .
5458```
5559
5660to install the generated parser in your virtual environment.
5761
5862
5963Additional requirements
6064-----------------------
61- The queryparser assumes that the PostgreSQL database has the extension
62- [ pg_sphere] ( https://github.com/kimakan/pgsphere/tree/aiprdbms16 ) installed. Although the ` pg_sphere ` is not required for the
63- python module, the PostgreSQL ** queries will not run ** without that extension
64- installed on the database.
65+ The queryparser assumes that the PostgreSQL database has the extension
66+ [ pg_sphere] ( https://github.com/kimakan/pgsphere/tree/aiprdbms16 ) installed.
67+ Although the ` pg_sphere ` is not required for the python module, the PostgreSQL
68+ ** queries will not run ** without this extension installed on the database.
6569
6670
6771Parsing MySQL and PostgreSQL
@@ -74,21 +78,21 @@ Parsing and processing of MySQL queries can be done by creating an instance
7478of the ` MySQLQueryProcessor ` class
7579
7680``` python
77- from queryparser.mysql import MySQLQueryProcessor
78- qp = MySQLQueryProcessor()
81+ from queryparser.mysql import MySQLQueryProcessor
82+ qp = MySQLQueryProcessor()
7983```
8084
8185feeding it a MySQL query
8286
8387``` python
84- sql = " SELECT a FROM db.tab;"
85- qp.set_query(sql)
88+ sql = " SELECT a FROM db.tab;"
89+ qp.set_query(sql)
8690```
8791
8892and running it with
8993
9094``` python
91- qp.process_query()
95+ qp.process_query()
9296```
9397
9498After the processing is completed, the processor object ` qp ` will include
@@ -101,8 +105,8 @@ PostgreSQL parsing is very similar to MySQL, except it requires importing
101105the ` PostgreSQLProcessor ` class:
102106
103107``` python
104- from queryparser.postgresql import PostgreSQLQueryProcessor
105- qp = PostgreSQLQueryProcessor()
108+ from queryparser.postgresql import PostgreSQLQueryProcessor
109+ qp = PostgreSQLQueryProcessor()
106110```
107111
108112The rest of the functionality remains the same.
@@ -115,15 +119,15 @@ Translation of ADQL queries is done similarly by first creating an instance of
115119the ` ADQLQueryTranslator ` class
116120
117121``` python
118- from queryparser.adql import ADQLQueryTranslator
119- adql = " SELECT TOP 100 POINT('ICRS', ra, de) FROM db.tab;"
120- adt = ADQLQueryTranslator(adql)
122+ from queryparser.adql import ADQLQueryTranslator
123+ adql = " SELECT TOP 100 POINT('ICRS', ra, de) FROM db.tab;"
124+ adt = ADQLQueryTranslator(adql)
121125```
122126
123127and calling
124128
125129``` python
126- adt.to_postgresql()
130+ adt.to_postgresql()
127131```
128132
129133which returns a translated string representing a valid MySQL query if
@@ -133,16 +137,16 @@ the ADQL query had no errors. The PostgreSQL query can then be parsed with the
133137Testing
134138-------
135139
136- First, install ` pytest `
140+ First in the root directory of the project, install optional dependencies
141+ (` PyYAML ` and ` pytest ` ) by running
137142
138143``` bash
139- pip install pytest
144+ python -m pip install .[test]
140145```
141146
142- then run the test suite for a version of python you would like to test with
147+ then run the test suite with
143148
144149``` bash
145- pytest lib/
150+ python -m pytest lib/
146151```
147152
148- More elaborate testing procedures can be found in the development notes.
0 commit comments