Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

Parses MySQL and translates ADQL to MySQL.

Project Description

Let’s parse some MySQL and ADQL!

Parsing MySQL

Processing of MySQL queries is done by first creating an instance of the MySQLQueryProcessor class

from queryparser.mysql import MySQLQueryProcessor

qp = MySQLQueryProcessor()

feeding it a MySQL query

sql = "SELECT a FROM b;"

and running it with


After the processing, the processor object will include columns, functions, and keywords used in the query.

Alternatively, passing the query at initialization automatically processes it.

Translating ADQL

Translation of ADQL queries is done similarly by first creating an instance of the ADQLQueryTranslator class

from queryparser.adql import ADQLQueryTranslator

adql = "SELECT TOP 100 a,b FROM c"
adt = ADQLQueryTranslator(adql)

and calling


which returns a translated string.

Generating the parser from the git repository

To generate the parsers you need python (either 2 or 3), java above version 7, and antlr4 (which has to be installed inside the /usr/local/lib/ or /usr/local/bin/ directories).

After cloning the project, run


and a lib directory will be created with the complete source for python2 and python3. After that, run:

python install

to install the generated parser in you virtual env.


There are some example queries in the testing directory. Have a look there, edit (just comment out/uncomment the line you want in main) and run it:

python testing/

This will parse a number of queries (specified in the corresponding example-files) and print the query, the parsed columns and the parsing time.


  • more Documentation
  • ADQL coordinate systems
  • ADQL mixed coordinates
Release History

Release History

This version
History Node


History Node

History Node

History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
queryparser-python3-0.1.1.tar.gz (211.7 kB) Copy SHA256 Checksum SHA256 Source Aug 15, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting