Query Hub
Sometimes we want to answer a simple data question, but we don’t want (or know how) to write the SQL query. The Query Hub is a collection of SQL queries that you can run on your data
For example, let’s say you want the count of commits someone made on a Git repository. You could use a community query to get this information.
Usage
You can find the full extent of the community repository here. If you want to suggest a query, feel free to do so here or directly open a pull request on the repository.
Once you have found a query you want to run, you can use the anyquery run
command to execute it. Just copy the command and run it in your terminal.
Anyquery will take care of asking you for the necessary information to run the query.
You can also run a query from an https URL, or from a local file. For example, to run a query from a URL:
Contributing
By contributing to the Query Hub, you can help others answer their data questions, thank you for your help! Queries start with a top-level comment that describes what the query does in TOML. Here is an example:
Here is an overview of the fields you can use in the top-level comment:
title
: The title of the query. Often, it’s formatted as a question.description
: A short description of what the query does to help users find it in the Query Hub.plugins
: An array of plugins that the query uses.author
: The github username of the author.tags
: An array of tags to help users find the query.arguments
: An array of arguments that the query needs to run. Each argument is an object with the following fields:title
: The title of the argument.display_title
: The title of the argument displayed to the user.type
: The type of the argument. It can bestring
,int
,float
andbool
.description
: A description of the argument.regex
: A regex to validate the argument.
Each argument in the arguments
array will be asked to the user when running the query. They will be passed to the query as named parameters. You can specify them in the query using the @
symbol followed by the argument name.
Reference
You can find the full documentation of the anyquery run
command here.