The Data Explorer plugin allows you to make SQL queries against your live database, allowing for up-to-the-minute stats reporting.
Usage
After installing the plugin, head to /admin/plugins
. Click on the "Settings" button, and turn on "data explorer enabled", then return and reload the page.
There should now be a tab in the stacked nav called "Data Explorer". Select it, then use the + and Import buttons to create or import queries. For an example, let's import one that I wrote.
Download this file, then open the import dialog and drag the file onto the dialog.
most-common-likers.dcquery (1).json (442 Bytes)
Click Import to save it to the server. Select the query from the drop-down box, and try running it with the Run Query button. (Note: For the purposes of demonstration, I checked the "Include query plan" box.)
Looks like all of the Discourse developers like each other quite a bit.
Writing Queries
TODO
Declaring Parameters
TODO
-- [params]
-- null string_list :words
-- null string_list :categories
WITH words AS (
SELECT unnest(string_to_array( :words, ',' )) word
),
cats1 AS (
SELECT unnest(string_to_array( :categories, ',')) cat
),
Installation
If you're on a hosted Discourse forum and the data explorer doesn't show up at /admin/plugins, email us at team@discourse.org to ask us to add it for you.
For self-hosted discourse forums, follow the Install A Plugin guide using https://github.com/discourse/discourse-data-explorer.git .