queryparser-python3 0.6.1__tar.gz → 0.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/PKG-INFO +63 -33
  2. queryparser-python3-0.6.1/lib/queryparser_python3.egg-info/PKG-INFO → queryparser_python3-0.7.0/README.md +42 -39
  3. queryparser_python3-0.7.0/lib/queryparser/__init__.py +1 -0
  4. queryparser_python3-0.7.0/lib/queryparser/adql/ADQLLexer.py +1465 -0
  5. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/adql/ADQLParser.py +2104 -2240
  6. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/adql/ADQLParserListener.py +38 -56
  7. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/adql/ADQLParserVisitor.py +22 -32
  8. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/adql/adqltranslator.py +178 -72
  9. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/common/common.py +1 -36
  10. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/mysql/MySQLLexer.py +2 -2
  11. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/mysql/MySQLParser.py +201 -212
  12. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/mysql/MySQLParserListener.py +2 -2
  13. queryparser_python3-0.7.0/lib/queryparser/postgresql/PostgreSQLLexer.py +1192 -0
  14. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/postgresql/PostgreSQLParser.py +2155 -1522
  15. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/postgresql/PostgreSQLParserListener.py +83 -2
  16. queryparser_python3-0.7.0/lib/queryparser/postgresql/postgresqllisteners.py +3 -0
  17. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/postgresql/postgresqlprocessor.py +1 -4
  18. queryparser_python3-0.7.0/lib/queryparser_python3.egg-info/PKG-INFO +179 -0
  19. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser_python3.egg-info/SOURCES.txt +1 -1
  20. queryparser_python3-0.7.0/lib/queryparser_python3.egg-info/requires.txt +5 -0
  21. queryparser_python3-0.7.0/pyproject.toml +57 -0
  22. queryparser-python3-0.6.1/README.md +0 -136
  23. queryparser-python3-0.6.1/lib/queryparser/__init__.py +0 -9
  24. queryparser-python3-0.6.1/lib/queryparser/adql/ADQLLexer.py +0 -1497
  25. queryparser-python3-0.6.1/lib/queryparser/postgresql/PostgreSQLLexer.py +0 -1104
  26. queryparser-python3-0.6.1/lib/queryparser/postgresql/postgresqllisteners.py +0 -51
  27. queryparser-python3-0.6.1/lib/queryparser_python3.egg-info/requires.txt +0 -3
  28. queryparser-python3-0.6.1/setup.py +0 -46
  29. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/LICENSE +0 -0
  30. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/adql/__init__.py +0 -0
  31. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/common/__init__.py +0 -0
  32. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/exceptions/__init__.py +0 -0
  33. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/mysql/__init__.py +0 -0
  34. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/mysql/mysqllisteners.py +0 -0
  35. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/mysql/mysqlprocessor.py +0 -0
  36. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser/postgresql/__init__.py +0 -0
  37. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser_python3.egg-info/dependency_links.txt +0 -0
  38. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/lib/queryparser_python3.egg-info/top_level.txt +0 -0
  39. {queryparser-python3-0.6.1 → queryparser_python3-0.7.0}/setup.cfg +0 -0
@@ -1,26 +1,42 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: queryparser-python3
3
- Version: 0.6.1
4
- Summary: Parses PostgreSQL/MySQL and translates ADQL to PostgreSQL/MySQL.
5
- Home-page: https://github.com/aipescience/queryparser
6
- Author: Gal Matijevic
7
- Author-email: gmatijevic@aip.de
8
- Maintainer: Gal Matijevic
9
- Maintainer-email: gmatijevic@aip.de
3
+ Version: 0.7.0
4
+ Summary: Package for parsing PostgreSQL/MySQL and translating ADQL to PostgreSQL/MySQL.
5
+ Author-email: Gal Matijevic <gmatijevic@aip.de>
6
+ Maintainer-email: Kirill Makan <kmakan@aip.de>
10
7
  License: Apache-2.0
8
+ Project-URL: Repository, https://github.com/aipescience/queryparser.git
9
+ Project-URL: Issues, https://github.com/aipescience/queryparser/issues
10
+ Project-URL: Changelog, https://github.com/aipescience/queryparser/blob/master/CHANGELOG.md
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Requires-Python: >=3.9
11
21
  Description-Content-Type: text/markdown
12
22
  License-File: LICENSE
23
+ Requires-Dist: antlr4-python3-runtime==4.13.1
24
+ Provides-Extra: test
25
+ Requires-Dist: pytest~=8.2.0; extra == "test"
26
+ Requires-Dist: PyYAML~=6.0; extra == "test"
13
27
 
14
28
  queryparser
15
29
  ===========
16
30
 
17
- **Tool for parsing and processing of MySQL/PostgreSQL and translation of
31
+ **Tool for parsing and processing of (MySQL\*)/PostgreSQL and translation of
18
32
  ADQL SELECT-like queries**
19
33
 
20
34
  Designed to be used in conjunction with [django-daiquri](https://github.com/django-daiquiri/daiquiri)
21
35
  as a query processing backend but it can be easily used as a stand-alone tool
22
36
  or integrated into another project.
23
37
 
38
+ **\*NOTE: Since version 0.7.0 MySQL is not supported (maintained) anymore.**
39
+
24
40
 
25
41
  [![pytest Workflow Status](https://github.com/aipescience/queryparser/actions/workflows/pytest.yml/badge.svg)](https://github.com/aipescience/queryparser/actions/workflows/pytest.yml)
26
42
  [![Coverage Status](https://coveralls.io/repos/aipescience/queryparser/badge.svg?branch=master&service=github)](https://coveralls.io/github/aipescience/queryparser?branch=master)
@@ -35,9 +51,7 @@ Installation
35
51
  The easiest way to install the package is by using the pip tool:
36
52
 
37
53
  ```bash
38
-
39
- pip install queryparser-python3
40
-
54
+ python -m pip install queryparser-python3
41
55
  ```
42
56
 
43
57
  Alternatively, you can clone the repository and install it from there.
@@ -50,45 +64,62 @@ Generating the parser from the git repository
50
64
 
51
65
  To generate the parsers you need `python3` , `java` above version
52
66
  7, and `antlr4` (`antlr-4.*-complete.jar` has to be installed inside the
53
- `/usr/local/lib/` or `/usr/local/bin/` directories).
67
+ `/usr/local/lib/`, `/usr/local/bin/` or root directory of the project).
68
+
69
+ The current version of `antlr-4.*-complete.jar` can be downloaded via
70
+
71
+ ```bash
72
+ wget http://www.antlr.org/download/antlr-4.13.1-complete.jar
73
+ ```
54
74
 
55
75
  After cloning the project run
56
76
 
57
77
  ```bash
58
- make
78
+ make
59
79
  ```
60
80
 
61
81
  and a `lib` directory will be created. After that, run
62
82
 
63
83
  ```bash
64
- python setup.py install
84
+ python -m pip install .
65
85
  ```
66
86
 
67
87
  to install the generated parser in your virtual environment.
68
88
 
69
89
 
90
+ Additional requirements
91
+ -----------------------
92
+ The queryparser assumes that the PostgreSQL database has the extension
93
+ [pg_sphere](https://github.com/kimakan/pgsphere/tree/aiprdbms16) installed.
94
+ Although the `pg_sphere` is not required for the python module, the PostgreSQL
95
+ **queries will not run** without this extension installed on the database.
96
+
97
+
70
98
  Parsing MySQL and PostgreSQL
71
99
  ----------------------------
72
100
 
101
+ **Since version 0.7, MySQL part of the parser is not maintained anymore.
102
+ Thus, the MySQL related functionality cannot be guaranteed!**
103
+
73
104
  Parsing and processing of MySQL queries can be done by creating an instance
74
105
  of the `MySQLQueryProcessor` class
75
106
 
76
107
  ```python
77
- from queryparser.mysql import MySQLQueryProcessor
78
- qp = MySQLQueryProcessor()
108
+ from queryparser.mysql import MySQLQueryProcessor
109
+ qp = MySQLQueryProcessor()
79
110
  ```
80
111
 
81
112
  feeding it a MySQL query
82
113
 
83
114
  ```python
84
- sql = "SELECT a FROM db.tab;"
85
- qp.set_query(sql)
115
+ sql = "SELECT a FROM db.tab;"
116
+ qp.set_query(sql)
86
117
  ```
87
118
 
88
119
  and running it with
89
120
 
90
121
  ```python
91
- qp.process_query()
122
+ qp.process_query()
92
123
  ```
93
124
 
94
125
  After the processing is completed, the processor object `qp` will include
@@ -101,8 +132,8 @@ PostgreSQL parsing is very similar to MySQL, except it requires importing
101
132
  the `PostgreSQLProcessor` class:
102
133
 
103
134
  ```python
104
- from queryparser.postgresql import PostgreSQLQueryProcessor
105
- qp = PostgreSQLQueryProcessor()
135
+ from queryparser.postgresql import PostgreSQLQueryProcessor
136
+ qp = PostgreSQLQueryProcessor()
106
137
  ```
107
138
 
108
139
  The rest of the functionality remains the same.
@@ -115,35 +146,34 @@ Translation of ADQL queries is done similarly by first creating an instance of
115
146
  the `ADQLQueryTranslator` class
116
147
 
117
148
  ```python
118
- from queryparser.adql import ADQLQueryTranslator
119
- adql = "SELECT TOP 100 POINT('ICRS', ra, de) FROM db.tab;"
120
- adt = ADQLQueryTranslator(adql)
149
+ from queryparser.adql import ADQLQueryTranslator
150
+ adql = "SELECT TOP 100 POINT('ICRS', ra, de) FROM db.tab;"
151
+ adt = ADQLQueryTranslator(adql)
121
152
  ```
122
153
 
123
154
  and calling
124
155
 
125
156
  ```python
126
- adt.to_mysql()
157
+ adt.to_postgresql()
127
158
  ```
128
159
 
129
160
  which returns a translated string representing a valid MySQL query if
130
- the ADQL query had no errors. The MySQL query can then be parsed with the
131
- `MySQLQueryProcessor` in the same way as shown above.
132
-
161
+ the ADQL query had no errors. The PostgreSQL query can then be parsed with the
162
+ `PostgreSQLQueryProcessor` in the same way as shown above.
133
163
 
134
164
  Testing
135
165
  -------
136
166
 
137
- First, install `pytest`
167
+ First in the root directory of the project, install optional dependencies
168
+ (`PyYAML` and `pytest`) by running
138
169
 
139
170
  ```bash
140
- pip install pytest
171
+ python -m pip install .[test]
141
172
  ```
142
173
 
143
- then run the test suite for a version of python you would like to test with
174
+ then run the test suite with
144
175
 
145
176
  ```bash
146
- pytest lib/
177
+ python -m pytest lib/
147
178
  ```
148
179
 
149
- More elaborate testing procedures can be found in the development notes.
@@ -1,26 +1,15 @@
1
- Metadata-Version: 2.1
2
- Name: queryparser-python3
3
- Version: 0.6.1
4
- Summary: Parses PostgreSQL/MySQL and translates ADQL to PostgreSQL/MySQL.
5
- Home-page: https://github.com/aipescience/queryparser
6
- Author: Gal Matijevic
7
- Author-email: gmatijevic@aip.de
8
- Maintainer: Gal Matijevic
9
- Maintainer-email: gmatijevic@aip.de
10
- License: Apache-2.0
11
- Description-Content-Type: text/markdown
12
- License-File: LICENSE
13
-
14
1
  queryparser
15
2
  ===========
16
3
 
17
- **Tool for parsing and processing of MySQL/PostgreSQL and translation of
4
+ **Tool for parsing and processing of (MySQL\*)/PostgreSQL and translation of
18
5
  ADQL SELECT-like queries**
19
6
 
20
7
  Designed to be used in conjunction with [django-daiquri](https://github.com/django-daiquiri/daiquiri)
21
8
  as a query processing backend but it can be easily used as a stand-alone tool
22
9
  or integrated into another project.
23
10
 
11
+ **\*NOTE: Since version 0.7.0 MySQL is not supported (maintained) anymore.**
12
+
24
13
 
25
14
  [![pytest Workflow Status](https://github.com/aipescience/queryparser/actions/workflows/pytest.yml/badge.svg)](https://github.com/aipescience/queryparser/actions/workflows/pytest.yml)
26
15
  [![Coverage Status](https://coveralls.io/repos/aipescience/queryparser/badge.svg?branch=master&service=github)](https://coveralls.io/github/aipescience/queryparser?branch=master)
@@ -35,9 +24,7 @@ Installation
35
24
  The easiest way to install the package is by using the pip tool:
36
25
 
37
26
  ```bash
38
-
39
- pip install queryparser-python3
40
-
27
+ python -m pip install queryparser-python3
41
28
  ```
42
29
 
43
30
  Alternatively, you can clone the repository and install it from there.
@@ -50,45 +37,62 @@ Generating the parser from the git repository
50
37
 
51
38
  To generate the parsers you need `python3` , `java` above version
52
39
  7, and `antlr4` (`antlr-4.*-complete.jar` has to be installed inside the
53
- `/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
+ ```
54
47
 
55
48
  After cloning the project run
56
49
 
57
50
  ```bash
58
- make
51
+ make
59
52
  ```
60
53
 
61
54
  and a `lib` directory will be created. After that, run
62
55
 
63
56
  ```bash
64
- python setup.py install
57
+ python -m pip install .
65
58
  ```
66
59
 
67
60
  to install the generated parser in your virtual environment.
68
61
 
69
62
 
63
+ Additional requirements
64
+ -----------------------
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.
69
+
70
+
70
71
  Parsing MySQL and PostgreSQL
71
72
  ----------------------------
72
73
 
74
+ **Since version 0.7, MySQL part of the parser is not maintained anymore.
75
+ Thus, the MySQL related functionality cannot be guaranteed!**
76
+
73
77
  Parsing and processing of MySQL queries can be done by creating an instance
74
78
  of the `MySQLQueryProcessor` class
75
79
 
76
80
  ```python
77
- from queryparser.mysql import MySQLQueryProcessor
78
- qp = MySQLQueryProcessor()
81
+ from queryparser.mysql import MySQLQueryProcessor
82
+ qp = MySQLQueryProcessor()
79
83
  ```
80
84
 
81
85
  feeding it a MySQL query
82
86
 
83
87
  ```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)
86
90
  ```
87
91
 
88
92
  and running it with
89
93
 
90
94
  ```python
91
- qp.process_query()
95
+ qp.process_query()
92
96
  ```
93
97
 
94
98
  After 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
101
105
  the `PostgreSQLProcessor` class:
102
106
 
103
107
  ```python
104
- from queryparser.postgresql import PostgreSQLQueryProcessor
105
- qp = PostgreSQLQueryProcessor()
108
+ from queryparser.postgresql import PostgreSQLQueryProcessor
109
+ qp = PostgreSQLQueryProcessor()
106
110
  ```
107
111
 
108
112
  The rest of the functionality remains the same.
@@ -115,35 +119,34 @@ Translation of ADQL queries is done similarly by first creating an instance of
115
119
  the `ADQLQueryTranslator` class
116
120
 
117
121
  ```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)
121
125
  ```
122
126
 
123
127
  and calling
124
128
 
125
129
  ```python
126
- adt.to_mysql()
130
+ adt.to_postgresql()
127
131
  ```
128
132
 
129
133
  which returns a translated string representing a valid MySQL query if
130
- the ADQL query had no errors. The MySQL query can then be parsed with the
131
- `MySQLQueryProcessor` in the same way as shown above.
132
-
134
+ the ADQL query had no errors. The PostgreSQL query can then be parsed with the
135
+ `PostgreSQLQueryProcessor` in the same way as shown above.
133
136
 
134
137
  Testing
135
138
  -------
136
139
 
137
- First, install `pytest`
140
+ First in the root directory of the project, install optional dependencies
141
+ (`PyYAML` and `pytest`) by running
138
142
 
139
143
  ```bash
140
- pip install pytest
144
+ python -m pip install .[test]
141
145
  ```
142
146
 
143
- then run the test suite for a version of python you would like to test with
147
+ then run the test suite with
144
148
 
145
149
  ```bash
146
- pytest lib/
150
+ python -m pytest lib/
147
151
  ```
148
152
 
149
- More elaborate testing procedures can be found in the development notes.
@@ -0,0 +1 @@
1
+ __version__ = '0.7.0'