SQLGitHub - Access GitHub API with SQL-like syntaxes
SQLGitHub features a SQL-like syntax that allows you to:
Query information about an organization as a whole.
You may also think of it as a better, enhanced frontend layer built on top of GitHub's RESTful API.
- Install prerequisites
pip install requests prompt_toolkit pygments regex- Install my patched PyGithub
git clone https://github.com/lnishan/PyGithub.git cd PyGithub ./setup.py build sudo ./setup.py install- Configure SQLGitHub (optional)
In root directory (same directory asSQLGitHub.py),
Create and editconfig.py:
token = "your token here" # can be obtained from https://github.com/settings/tokens output = "str" # or "csv" for csv output- Start SQLGitHub
./SQLGitHub.py→ Get name and description from all the repos in abseil.
select name, description from abseil.repos→ Get last-updated time and title of the issues closed in the past 3 days in servo listed in descending order of last-updated time.
select updated_at, title from servo.issues.closed.3 order by updated_at, desc→ Get top 10 most-starred repositories in servo.
select concat(concat("(", stargazers_count, ") ", name), ": ", description) from servo.repos order by stargazers_count desc, name limit 10→ Get top 10 contributors in servo for the past 7 days based on number of commits.
select login, count(login) from servo.commits.7 group by login order by count(login) desc, login limit 10SELECT select_expr [, select_expr ...] FROM {org_name | org_name.{repos | issues | pulls | commits}} [WHERE where_condition] [GROUP BY {col_name | expr} [ASC | DESC], ...] [HAVING where_condition] [ORDER BY {col_name | expr} [ASC | DESC], ...] [LIMIT row_count] Most of the fields listed in GitHub API v3 are available for query.
For example, for org_name.repos queries, you can specify id, name, full_name, description ... etc. in expr's.
We are actively adding support for functions.
Refer to components/expression.py for the current supported functions and operators.




