AskGit Newsletter

Share this post

Multi-Repo Queries Now Available

askgit.substack.com

Multi-Repo Queries Now Available

You can now write SQL queries spanning more than one repo with AskGit

Patrick DeVivo
Jul 21, 2021
Share this post

Multi-Repo Queries Now Available

askgit.substack.com

The latest AskGit release (v.0.4.0) now supports multi-repo queries 🎉. This has been a long-requested feature, and we’re very excited it’s now possible. This release includes a major rearchitecting of the structure of the project, an outcome of which is the use of table-valued-functions for all git functionality, which allows us to pass arguments into tables as if they were functions: SELECT * FROM commits('https://github.com/askgitdev/askgit')

See the README for more specific usage details, but currently, the first argument to any git table is treated as a repo “specifier.” In the CLI, it will default to the current working directory, or whatever is supplied by the —repo flag. This can be a path on disk, or an HTTP(s) remote (which will be cloned to a temporary directory).

So, if you wanted to know all the distinct authors (by name) in two repos, you could execute a query like this:

SELECT DISTINCT(author_name) FROM commits('https://github.com/askgitdev/askgit')
UNION
SELECT DISTINCT(author_name) FROM commits('https://github.com/askgitdev/treequery')
view raw multi-repo-ex.sql hosted with ❤ by GitHub

You can also try it for real on our demo site. Stay tuned for some more functionality that will make multi-repo queries a lot easier to work with if you use GitHub 😀.

Share this post

Multi-Repo Queries Now Available

askgit.substack.com
Comments
TopNew

No posts

Ready for more?

© 2023 AskGit, Inc.
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing