SQL interface to Git repositories, written in Go.
Go Shell
Latest commit 761ba5e Jan 13, 2017 @ajnavarro ajnavarro committed with smola cmd: very basic REPL implementation (#97)
* cmd: very basic REPL implementation

Basic REPL that only supports query executions.

README.md

gitql

Build Status codecov GoDoc

gitql is a SQL interface to Git repositories, written in Go.

WARNING: gitql is still in a very early stage of development. It is considered experimental.

Installation

Check the Releases page to download the gitql binary.

Usage

Usage:
  gitql [OPTIONS] <query | version>

Help Options:
  -h, --help  Show this help message

Available commands:
  query    Execute a SQL query a repository.
  version  Show the version information.

For example:

$ cd my_git_repo
$ gitql query 'SELECT hash, author_email, author_name FROM commits LIMIT 2;' 
SELECT hash, author_email, author_name FROM commits LIMIT 2;
+------------------------------------------+--------------------+---------------+
|                   HASH                   |   AUTHOR EMAIL     |  AUTHOR NAME  |
+------------------------------------------+--------------------+---------------+
| 02e0aa0ef807d2ae4d02ecdbe37681db9e812544 | Santiago M. Mola   | user1@test.io |
| 034cb63f77f4a0d30d26dabb999d348be6640df7 | Antonio J. Navarro | user2@test.io |
+------------------------------------------+--------------------+---------------+

Tables

gitql exposes the following tables:

  • commits (hash, author_name, author_email, author_time, comitter_name, comitter_email, comitter_time, message)
  • blobs (hash, size)
  • references (hash, name, is_branch, is_note, is_remote, is_tag, target)
  • tags (hash, name, tagger_email, tagger_name, tagger_when, message, target)
  • tree_entries (tree_hash, entry_hash, mode, name)

SQL syntax

gitql supports a subset of the SQL standard, currently including:

  • SELECT
  • WHERE
  • ORDER BY (with ASC and DESC)
  • LIMIT
  • GROUP BY (with COUNT and FIRST)
  • SHOW TABLES
  • DESCRIBE TABLE

License

gitql is licensed under the MIT License.