GitQL is a SQL-like language designed for querying data from GitHub repositories. It enables users to perform advanced queries on users, organizations, repositories, issues, pull requests, contributors, releases, milestones, and more, by leveraging a familiar SQL syntax.
- SQL-like syntax for querying GitHub data.
- Supports querying users, organizations, repositories, issues, pull requests, contributors, releases, milestones, teams, and labels.
- Filtering options for various fields such as
status,title,author,date, and more. - Sorting and limiting results with
ORDER BYandLIMIT. - Supports multiple conditions in queries using logical operators like
AND,OR, andNOT.
GitQL follows a simple SQL-like query syntax:
SELECT <column> [, <column> ...]
FROM { user | org } . { repos | stars | projects | info }
| repo . { issues | pull_requests | contributors | languages | commits | title | updated_at | description | milestones | labels | releases | collaborators | projects | teams }
[WHERE <condition>]
[ORDER BY { <column> | <expr> } [ASC | DESC]]
[LIMIT <row_limit>]SELECTFROMWHEREORDER BYASC,DESCIN- Logical operators:
AND,OR,NOT - Comparison operators:
GREATER,LESS,EQUAL,GEQ,LEQ
GitQL supports querying data from several entities and their respective fields. Below are the available entities and fields:
repos,stars,projects,info,followers,following
issues,pull_requests,contributors,languages,commits,title,updated_at,description,milestones,labels,releases,collaborators,projects,teams
status,label,author,assignee,title,description,created_at,updated_at,comments,milestone
status,author,assignee,title,created_at,updated_at,merged_at,milestone
author,date,message,hash
Here are some example queries you can run with GitQL:
-
Select open issues with specific label and milestone:
SELECT title, label, milestone FROM repo.issues WHERE status = 'open' AND label = 'bug' AND milestone = 'v1.0' ORDER BY updated_at DESC LIMIT 10
-
Select merged pull requests for a specific milestone:
SELECT title, assignee, merged_at, milestone FROM repo.pull_requests WHERE status = 'merged' AND milestone = 'v1.0' ORDER BY merged_at DESC LIMIT 5
-
Select contributors with more than 100 contributions:
SELECT name, username, contributions FROM repo.contributors WHERE contributions > 100 ORDER BY contributions DESC LIMIT 5
Each entity in GitQL allows filtering based on various fields like status, title, author, created_at, and more. You can use conditions like:
status = 'open'created_at > '2023-01-01'contributions > 100title LIKE '%bug%'assignee = 'john_doe'
This project is licensed under the MIT License - see the LICENSE file for details.
