Skip to content

💻 SQLGitHub — Managing GitHub organization made easier

License

Notifications You must be signed in to change notification settings

lnishan/SQLGitHub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQLGitHub

SQLGitHub — Managing GitHub organization made easier

Introduction

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", "html"
  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.
You may also use select * for the full list of fields.

Supported Functions

String Functions:
"concat", "concat_ws", "find_in_set", "insert", "instr", "length", "locate", "lcase", "lower", "left", "mid", "repeat", "right", "replace", "strcmp", "substr", "substring", "ucase", “upper"

Numeric Functions:
"avg", "count", "max", "min", “sum", "abs", "ceil", "ceiling", "exp", "floor", "greatest", "least", "ln", "log", "pow", "power", "sign", "sqrt"

Date & Advanced Functions:
"curdate", "current_date", "current_time", "current_timestamp", "curtime", "localtime", "localtimestamp", "now", “bin"

Releases

No releases published

Packages

No packages published

Languages