Skip to content

lnishan/SQLGitHub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQLGitHub

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.

ScreenshotIntro

Installation

  1. Install prerequisites
pip install requests prompt_toolkit pygments regex
  1. Install my patched PyGithub
git clone https://github.com/lnishan/PyGithub.git cd PyGithub ./setup.py build sudo ./setup.py install
  1. Configure SQLGitHub (optional)
    In root directory (same directory as SQLGitHub.py),
    Create and edit config.py:
token = "your token here" # can be obtained from https://github.com/settings/tokens output = "str" # or "csv" for csv output
  1. Start SQLGitHub
./SQLGitHub.py

Sample Usage

→ Get name and description from all the repos in abseil.

select name, description from abseil.repos

Screenshot1


→ 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

Screenshot2


→ 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

Screenshot3


→ 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 10

Screenshot4

SQL Language Support

Supported Schema

SELECT 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] 

Supported Fields

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.

Supported Functions and Operators

We are actively adding support for functions.
Refer to components/expression.py for the current supported functions and operators.

About

💻 SQLGitHub — Managing GitHub organization made easier

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages