{"id":38536673,"url":"https://github.com/aipescience/queryparser","last_synced_at":"2026-01-17T07:02:56.002Z","repository":{"id":53527840,"uuid":"60595666","full_name":"aipescience/queryparser","owner":"aipescience","description":"Parsing, processing, and translation of PostgreSQL, MySQL and ADQL queries","archived":false,"fork":false,"pushed_at":"2025-08-18T12:51:40.000Z","size":549,"stargazers_count":14,"open_issues_count":4,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-09-21T13:51:33.300Z","etag":null,"topics":["adql","daiquiri","mysql","parsing","query"],"latest_commit_sha":null,"homepage":"","language":"ANTLR","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aipescience.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-06-07T08:23:58.000Z","updated_at":"2025-08-18T12:51:35.000Z","dependencies_parsed_at":"2024-09-11T11:36:48.206Z","dependency_job_id":"f440761c-8f9b-41e9-a1d4-9168055a31da","html_url":"https://github.com/aipescience/queryparser","commit_stats":{"total_commits":371,"total_committers":10,"mean_commits":37.1,"dds":"0.32884097035040427","last_synced_commit":"18094a0a0f0662b0db1fd6f2eba7814fb04e5c36"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/aipescience/queryparser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aipescience%2Fqueryparser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aipescience%2Fqueryparser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aipescience%2Fqueryparser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aipescience%2Fqueryparser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aipescience","download_url":"https://codeload.github.com/aipescience/queryparser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aipescience%2Fqueryparser/sbom","scorecard":{"id":173306,"data":{"date":"2025-08-11","repo":{"name":"github.com/aipescience/queryparser","commit":"2c11d80f7c83898e7933601d80f742a005e3b062"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.9,"checks":[{"name":"Code-Review","score":1,"reason":"Found 2/11 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/pytest.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":4,"reason":"5 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pytest.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/aipescience/queryparser/pytest.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pytest.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/aipescience/queryparser/pytest.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/pytest.yml:22","Warn: pipCommand not pinned by hash: .github/workflows/pytest.yml:28","Warn: pipCommand not pinned by hash: .github/workflows/pytest.yml:29","Warn: pipCommand not pinned by hash: .github/workflows/pytest.yml:30","Warn: pipCommand not pinned by hash: .github/workflows/pytest.yml:47","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 25 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T17:07:19.375Z","repository_id":53527840,"created_at":"2025-08-16T17:07:19.375Z","updated_at":"2025-08-16T17:07:19.375Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28503021,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T06:57:29.758Z","status":"ssl_error","status_checked_at":"2026-01-17T06:56:03.931Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adql","daiquiri","mysql","parsing","query"],"created_at":"2026-01-17T07:02:55.867Z","updated_at":"2026-01-17T07:02:55.984Z","avatar_url":"https://github.com/aipescience.png","language":"ANTLR","funding_links":[],"categories":[],"sub_categories":[],"readme":"queryparser\n===========\n\n**Tool for parsing and processing of (MySQL\\*)/PostgreSQL and translation of\nADQL SELECT-like queries**\n\nDesigned to be used in conjunction with [django-daiquri](https://github.com/django-daiquiri/daiquiri)\nas a query processing backend but it can be easily used as a stand-alone tool\nor integrated into another project.\n\n**\\*NOTE: Since version 0.7.0 MySQL is not supported (maintained) anymore.**\n\n\n[![pytest Workflow Status](https://github.com/aipescience/queryparser/actions/workflows/pytest.yml/badge.svg)](https://github.com/aipescience/queryparser/actions/workflows/pytest.yml)\n[![Coverage Status](https://coveralls.io/repos/aipescience/queryparser/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/aipescience/queryparser?branch=master)\n[![License](http://img.shields.io/badge/license-APACHE-blue.svg?style=flat)](https://github.com/aipescience/queryparser/blob/master/LICENSE)\n[![Latest Version](https://img.shields.io/pypi/v/queryparser-python3.svg?style=flat)](https://pypi.org/project/queryparser-python3/)\n\n\n\nInstallation\n------------\n\nThe easiest way to install the package is by using the pip tool:\n\n```bash\npython -m pip install queryparser-python3\n```\n\nAlternatively, you can clone the repository and install it from there.\nHowever, this step also requires generating the parser which is a slightly\nmore elaborate process (see below).\n\n\nGenerating the parser from the git repository\n---------------------------------------------\n\nTo generate the parsers you need `python3` , `java` above version\n7, and `antlr4` (`antlr-4.*-complete.jar` has to be installed inside the\n`/usr/local/lib/`, `/usr/local/bin/`  or root directory of the project).\n\nThe current version of `antlr-4.*-complete.jar` can be downloaded via\n\n```bash\nwget http://www.antlr.org/download/antlr-4.13.1-complete.jar\n```\n\nAfter cloning the project run\n\n```bash\nmake\n```\n\nand a `lib` directory will be created. After that, run\n\n```bash\npython -m pip install .\n```\n\nto install the generated parser in your virtual environment.\n\n\nAdditional requirements\n-----------------------\nThe queryparser assumes that the PostgreSQL database has the extension\n[pg_sphere](https://github.com/kimakan/pgsphere/tree/aiprdbms16) installed.\nAlthough the `pg_sphere` is not required for the python module, the PostgreSQL\n**queries will not run** without this extension installed on the database.\n\n\nParsing MySQL and PostgreSQL\n----------------------------\n\n**Since version 0.7, MySQL part of the parser is not maintained anymore.\nThus, the MySQL related functionality cannot be guaranteed!**\n\nParsing and processing of MySQL queries can be done by creating an instance\nof the `MySQLQueryProcessor` class\n\n```python\nfrom queryparser.mysql import MySQLQueryProcessor\nqp = MySQLQueryProcessor()\n```\n\nfeeding it a MySQL query\n\n```python\nsql = \"SELECT a FROM db.tab;\"\nqp.set_query(sql)\n```\n\nand running it with\n\n```python\nqp.process_query()\n```\n\nAfter the processing is completed, the processor object `qp` will include\ntables, columns, functions, and keywords used in the query or will raise a\n`QuerySyntaxError` if there are any syntax errors in the query.\n\nAlternatively, passing the query at initialization automatically processes it.\n\nPostgreSQL parsing is very similar to MySQL, except it requires importing\nthe `PostgreSQLProcessor` class:\n\n```python\nfrom queryparser.postgresql import PostgreSQLQueryProcessor\nqp = PostgreSQLQueryProcessor()\n```\n\nThe rest of the functionality remains the same.\n\n\nTranslating ADQL\n----------------\n\nTranslation of ADQL queries is done similarly by first creating an instance of\nthe `ADQLQueryTranslator` class\n\n```python\nfrom queryparser.adql import ADQLQueryTranslator\nadql = \"SELECT TOP 100 POINT('ICRS', ra, de) FROM db.tab;\"\nadt = ADQLQueryTranslator(adql)\n```\n\nand calling\n\n```python\nadt.to_postgresql()\n```\n\nwhich returns a translated string representing a valid MySQL query if\nthe ADQL query had no errors. The PostgreSQL query can then be parsed with the\n`PostgreSQLQueryProcessor` in the same way as shown above.\n\nTesting\n-------\n\nFirst in the root directory of the project, install optional dependencies \n(`PyYAML` and `pytest`) by running\n\n```bash\npython -m pip install .[test]\n```\n\nthen run the test suite with\n\n```bash\npython -m pytest lib/\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faipescience%2Fqueryparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faipescience%2Fqueryparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faipescience%2Fqueryparser/lists"}