The query results in Querybook can be transformed to provide meaningful statistics or visualization. This can be tailored to the needs of the organization through the use of web plugins. Common use cases include:
- Add an external URL to the result cell
- Transform the cell into images or videos
- Format a number cell into a human-readable format
- Get the sum/avg of cells in a column
To implement the features above, we would need to add detectors, analyzers, and transformers. In the next section, we will cover each in detail as well as how to add them to Querybook.
Detectors are used to figure out the "type" of a column. The detector gets provided with the column name and all values under that column to evaluate the type of the column.
Analyzers provide meaningful statistics such as average, min, max, and median. They form many to many relationships with the type detected by detectors. The stat generated by an analyzer is calculated based on all values of a column. Since Querybook's frontend can only show a limited amount of rows, the stats generated may not be representative of the actual query result and should only be used as a reference. You can view the stats of a column by hovering over the zap icon in the column header.
Depending on the use case, transformers/analyzers/detectors can be added to Querybook either directly in the source code or as a plugin. The default transformers/analyzers/detectors are located under querybook/webapp/lib/query-result/ and they serve as examples of how to add these features.
For org specific use cases, you can add transformers/analyzers/detectors by setting the following variables in the window object in the web plugin (See this Plugin Guide to learn how to set up plugins for Querybook). They are:
The typing for these variables are defined in App.tsx for reference.