queryparser-python3 0.7.3__tar.gz → 0.7.4__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 (34) hide show
  1. {queryparser_python3-0.7.3/lib/queryparser_python3.egg-info → queryparser_python3-0.7.4}/PKG-INFO +1 -1
  2. queryparser_python3-0.7.4/lib/queryparser/__init__.py +1 -0
  3. queryparser_python3-0.7.4/lib/queryparser/adql/adqlprocessor.py +23 -0
  4. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/adql/adqltranslator.py +6 -9
  5. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4/lib/queryparser_python3.egg-info}/PKG-INFO +1 -1
  6. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser_python3.egg-info/SOURCES.txt +1 -0
  7. queryparser_python3-0.7.3/lib/queryparser/__init__.py +0 -1
  8. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/LICENSE +0 -0
  9. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/README.md +0 -0
  10. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/adql/ADQLLexer.py +0 -0
  11. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/adql/ADQLParser.py +0 -0
  12. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/adql/ADQLParserListener.py +0 -0
  13. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/adql/ADQLParserVisitor.py +0 -0
  14. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/adql/__init__.py +0 -0
  15. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/common/__init__.py +0 -0
  16. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/common/common.py +0 -0
  17. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/exceptions/__init__.py +0 -0
  18. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/mysql/MySQLLexer.py +0 -0
  19. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/mysql/MySQLParser.py +0 -0
  20. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/mysql/MySQLParserListener.py +0 -0
  21. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/mysql/__init__.py +0 -0
  22. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/mysql/mysqllisteners.py +0 -0
  23. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/mysql/mysqlprocessor.py +0 -0
  24. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/postgresql/PostgreSQLLexer.py +0 -0
  25. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/postgresql/PostgreSQLParser.py +0 -0
  26. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/postgresql/PostgreSQLParserListener.py +0 -0
  27. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/postgresql/__init__.py +0 -0
  28. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/postgresql/postgresqllisteners.py +0 -0
  29. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser/postgresql/postgresqlprocessor.py +0 -0
  30. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser_python3.egg-info/dependency_links.txt +0 -0
  31. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser_python3.egg-info/requires.txt +0 -0
  32. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/lib/queryparser_python3.egg-info/top_level.txt +0 -0
  33. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/pyproject.toml +0 -0
  34. {queryparser_python3-0.7.3 → queryparser_python3-0.7.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: queryparser-python3
3
- Version: 0.7.3
3
+ Version: 0.7.4
4
4
  Summary: Package for parsing PostgreSQL/MySQL and translating ADQL to PostgreSQL/MySQL.
5
5
  Author-email: Gal Matijevic <gmatijevic@aip.de>
6
6
  Maintainer-email: Kirill Makan <kmakan@aip.de>, Simeon Reusch <sreusch@aip.de>
@@ -0,0 +1 @@
1
+ __version__ = '0.7.4'
@@ -0,0 +1,23 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ ADQL processor. Its task is to check if a query has any syntax errors and
4
+ to extract all accessed columns as well as keywords and functions being
5
+ used in a query.
6
+
7
+ """
8
+
9
+ from __future__ import absolute_import, print_function
10
+
11
+ __all__ = ["ADQLQueryProcessor"]
12
+
13
+ from ..common import SQLQueryProcessor
14
+ from .ADQLLexer import ADQLLexer
15
+ from .ADQLParser import ADQLParser
16
+ from .ADQLParserListener import ADQLParserListener
17
+
18
+
19
+ class ADQLQueryProcessor(SQLQueryProcessor):
20
+ def __init__(self, query=None):
21
+ super().__init__(
22
+ ADQLLexer, ADQLParser, ADQLParserListener, '"', query
23
+ )
@@ -4,6 +4,7 @@ from __future__ import absolute_import
4
4
 
5
5
  import antlr4
6
6
  from antlr4.error.ErrorListener import ErrorListener
7
+ import re
7
8
 
8
9
  from .ADQLLexer import ADQLLexer
9
10
  from .ADQLParser import ADQLParser
@@ -470,15 +471,6 @@ class ADQLFunctionsTranslationVisitor(ADQLParserVisitor):
470
471
  _remove_children(ctx)
471
472
  self.contexts[ctx] = ctx_text
472
473
 
473
- def visitMath_function(self, ctx):
474
- ctx_text = ctx.getText()
475
- if self.output_sql == 'postgresql' and ctx_text[:5].lower() == 'log10':
476
- _remove_children(ctx)
477
- self.contexts[ctx] = 'LOG' + ctx_text[5:]
478
- elif self.output_sql == 'postgresql' and ctx_text[:3].lower() == 'log':
479
- _remove_children(ctx)
480
- self.contexts[ctx] = 'LN' + ctx_text[3:]
481
-
482
474
 
483
475
  class SelectQueryListener(ADQLParserListener):
484
476
  def __init__(self):
@@ -691,4 +683,9 @@ class ADQLQueryTranslator(object):
691
683
  translator_visitor.visit(self.tree)
692
684
 
693
685
  translated_query = self.translate(translator_visitor)
686
+
687
+ # Translate LOG10 to LOG and LOG to LN. It's not the most elegant solution but it works.
688
+ translated_query = re.sub(r'(?<=[\+\-\*/\(\s,])log\(', 'LN(', translated_query, flags=re.IGNORECASE)
689
+ translated_query = re.sub(r'(?<=[\+\-\*/\(\s,])log10\(', 'LOG(', translated_query, flags=re.IGNORECASE)
690
+
694
691
  return translated_query
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: queryparser-python3
3
- Version: 0.7.3
3
+ Version: 0.7.4
4
4
  Summary: Package for parsing PostgreSQL/MySQL and translating ADQL to PostgreSQL/MySQL.
5
5
  Author-email: Gal Matijevic <gmatijevic@aip.de>
6
6
  Maintainer-email: Kirill Makan <kmakan@aip.de>, Simeon Reusch <sreusch@aip.de>
@@ -7,6 +7,7 @@ lib/queryparser/adql/ADQLParser.py
7
7
  lib/queryparser/adql/ADQLParserListener.py
8
8
  lib/queryparser/adql/ADQLParserVisitor.py
9
9
  lib/queryparser/adql/__init__.py
10
+ lib/queryparser/adql/adqlprocessor.py
10
11
  lib/queryparser/adql/adqltranslator.py
11
12
  lib/queryparser/common/__init__.py
12
13
  lib/queryparser/common/common.py
@@ -1 +0,0 @@
1
- __version__ = '0.7.3'