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.)

Writing Queries

The top two boxes are the name and description of the query. The name is what you’re selecting in the dropdown box, and the description should be used for things like explaining what to put in the query parameters or to describe what data is being queried.

The left pane is where you write the SQL query. Minor syntax highlighting and checking is provided.

The schema explorer is on the right side of the writing pane. Note the red column names with a warning symbol, such as email, password_hash, salt - these are “Sensitive” columns. Try to avoid querying them if possible, reconsider querying them if you are in a public location, and definitely do not post screenshots of queries checking those columns without thinking about what you’re doing first.

You have to go into the postgresql database to execute update queries.

Is there a common, preferred postgresql front end you might suggest?

Is it reasonable to use such an approach to, say, change which Categories a group of users are Watching? Or are there simpler ways to go about that kind of update other than manually drilling into each user’s preferences from the UI?

Ah, the API. I keep forgetting about the API. So as an example, say we want to add a new Category to all user’s preferences to set those users to Watching this category. I go to the API and search user preference but don’t see anything obvious.

Where’s a good place to go to find example scripts for basic tasks to get one started?

Discourse is backed by a complete JSON api. Anything you can do on the site you can also do using the JSON api.
Many of the endpoints are properly documented in the discourse_api gem, however some endpoints lack documentation.
To determine how to do something with the JSON API here are some steps you can follow.
Example: recategorize a topic.
Go to a topic and start editing a category:
[image]
Open Chrome dev tools, switch to the Network tab, select XHR filter:
[image]
Perform the op…

It reminds me of a plugin from the vB world called WebTemplates - it consisted of two parts (WebTemplates and WebQueries), the WebQueries side is basically like your Data Explorer Plugin! The WebTemplates part is where you can create pages to use saved queries from the WebQueries section.

Towards the bottom you can specify which queries you want available for that page - then in the fields above you specify the HTML and where the result of those queries would show.

We used this on a vB site to power pages like homepage, news homepage, articles homepage, etc then each news item or each article was simple a forum thread that was styled differently for the first post and subsequent posts (using simple statements like if $post == 1 etc). So the entire site was powered by vB.

I’d love to see something like this for DC. I reckon it could take on the publishing world quite easily!!