@@ -4,34 +4,26 @@ queryparser
44** Tool for parsing and processing of MySQL/PostgreSQL and translation of
55ADQL SELECT-like queries**
66
7- Designed to be used in conjunction with ` django-daiquri < http ://github.com/aipescience/ django-daiquiri/>`_
7+ Designed to be used in conjunction with [ django-daiquri] ( https ://github.com/django-daiquiri/daiquiri )
88as a query processing backend but it can be easily used as a stand-alone tool
99or integrated into another project.
1010
11- .. image :: https://travis-ci.org/aipescience/queryparser.svg?branch=master
12- :alt: Build Status
13- :target: https://travis-ci.org/aipescience/queryparser
1411
15- .. image :: https://coveralls.io/repos/github/aipescience/queryparser/badge.svg?branch=master
16- :alt: Coverage Status
17- :target: https://coveralls.io/github/aipescience/queryparser?branch=master
12+ [ ![ pytest Workflow Status] ( https://github.com/aipescience/queryparser/actions/workflows/pytest.yml/badge.svg )] ( https://github.com/aipescience/queryparser/actions/workflows/pytest.yml )
13+ [ ![ Coverage Status] ( https://coveralls.io/repos/aipescience/queryparser/badge.svg?branch=dev&service=github )] ( https://coveralls.io/github/aipescience/queryparser?branch=dev )
14+ [ ![ License] ( http://img.shields.io/badge/license-APACHE-blue.svg?style=flat )] ( https://github.com/aipescience/queryparser/blob/master/LICENSE )
15+ [ ![ Latest Version] ( https://img.shields.io/pypi/v/queryparser-python3.svg?style=flat )] ( https://pypi.org/project/queryparser-python3/ )
1816
19- .. image :: https://img.shields.io/pypi/v/queryparser-python3.svg?style=flat
20- :alt: Latest Version
21- :target: https://pypi.python.org/pypi/queryparser-python3/
22-
23- .. image :: http://img.shields.io/badge/license-APACHE-blue.svg?style=flat
24- :target: https://github.com/adrn/schwimmbad/blob/master/LICENSE
2517
2618
2719Installation
2820------------
2921
3022The easiest way to install the package is by using the pip tool:
3123
32- .. code-block :: shell
33-
24+ ``` bash
3425 pip install queryparser-python3
26+ ```
3527
3628Alternatively, you can clone the repository and install it from there.
3729However, this step also requires generating the parser which is a slightly
@@ -41,21 +33,21 @@ more elaborate process (see below).
4133Generating the parser from the git repository
4234---------------------------------------------
4335
44- To generate the parsers you need `python3 ` , `java ` above version
45- 7, and `antlr4 ` (`antlr-4.*-complete.jar ` has to be installed inside the
36+ To generate the parsers you need ` python3 ` , ` java ` above version
37+ 7, and ` antlr4 ` (` antlr-4.*-complete.jar ` has to be installed inside the
4638` /usr/local/lib/ ` or ` /usr/local/bin/ ` directories).
4739
4840After cloning the project run
4941
50- .. code-block :: bash
51-
42+ ``` bash
5243 make
44+ ```
5345
5446and a ` lib ` directory will be created. After that, run
5547
56- .. code-block :: bash
57-
48+ ``` bash
5849 python setup.py install
50+ ```
5951
6052to install the generated parser in your virtual environment.
6153
@@ -66,24 +58,23 @@ Parsing MySQL and PostgreSQL
6658Parsing and processing of MySQL queries can be done by creating an instance
6759of the `` MySQLQueryProcessor `` class
6860
69- .. code-block :: python
70-
61+ ``` python
7162 from queryparser.mysql import MySQLQueryProcessor
72-
7363 qp = MySQLQueryProcessor()
64+ ```
7465
7566feeding it a MySQL query
7667
77- .. code-block :: python
78-
68+ ``` python
7969 sql = " SELECT a FROM db.tab;"
8070 qp.set_query(sql)
71+ ```
8172
8273and running it with
8374
84- .. code-block :: python
85-
75+ ``` python
8676 qp.process_query()
77+ ```
8778
8879After the processing is completed, the processor object `` qp `` will include
8980tables, columns, functions, and keywords used in the query or will raise a
@@ -94,11 +85,10 @@ Alternatively, passing the query at initialization automatically processes it.
9485PostgreSQL parsing is very similar to MySQL, except it requires importing
9586the ` PostgreSQLProcessor ` class:
9687
97- .. code-block :: python
98-
88+ ``` python
9989 from queryparser.postgresql import PostgreSQLQueryProcessor
100-
10190 qp = PostgreSQLQueryProcessor()
91+ ```
10292
10393The rest of the functionality remains the same.
10494
@@ -109,18 +99,17 @@ Translating ADQL
10999Translation of ADQL queries is done similarly by first creating an instance of
110100the `` ADQLQueryTranslator `` class
111101
112- .. code-block :: python
113-
102+ ``` python
114103 from queryparser.adql import ADQLQueryTranslator
115-
116104 adql = " SELECT TOP 100 POINT('ICRS', ra, de) FROM db.tab;"
117105 adt = ADQLQueryTranslator(adql)
106+ ```
118107
119108and calling
120109
121- .. code-block :: python
122-
110+ ``` python
123111 adt.to_mysql()
112+ ```
124113
125114which returns a translated string representing a valid MySQL query if
126115the ADQL query had no errors. The MySQL query can then be parsed with the
@@ -132,14 +121,14 @@ Testing
132121
133122First, install ` pytest `
134123
135- .. code-block :: bash
136-
124+ ``` bash
137125 pip install pytest
126+ ```
138127
139128then run the test suite for a version of python you would like to test with
140129
141- .. code-block :: bash
142-
130+ ``` bash
143131 pytest lib/
132+ ```
144133
145- More elaborate testing procedures can be found in the development notes.
134+ More elaborate testing procedures can be found in the development notes.
0 commit comments