New extensibility sub-category: Badge Queries

I’d like to propose the creation of a new sub-category for Extensibility, called “Badge Queries”.

This thread in particular is filled to the rim with excellent query snippets (major props to @PJH and @riking):

There’s also this:

And a couple other How-tos spread around.

This info ought to be easily searchable and maintainable. That could be achieved with a dedicated sub-forum, where each query snippet could have its own dedicated topic. Would also be a good use case for the new Post Templates, since each new topic should follow a template that goes something like this:

(Use the topic title to describe the most basic function of your query.)

**Suggested title:** {What would you call this query?}

{Please describe what this query does and how that might be useful.}

'''sql
Insert your query here
'''

In the future it might be worthwhile to keep the snippets in individual files collected in a GitHub repository, and display them in their respective topics via the link embeds. That would facilitate the creation of a more easily searchable interface (example: hookr.io).

6 Likes

To be honest, I am not a fan of the whole badge queries genre; the good ones we should just ship in each version of Discourse, and the bad ones can cripple performance on your site with horrendous or broken SQL.

Yeah, that’s another reason why I wanted these queries to be treated as more than a “cool tip”. Every custom query merits its own discussion and success/failure reports.

Including many of these queries in Discourse core would be great, but surely there will still be a few niche ones left out that ought to have space of their own.

A special tag or variety of the Solved plugin could be nice here too, i.e. to mark queries as “Tested” (or “Reviewed”, or “Safe”).

There could also be a “Query Author” badge.

4 Likes

Now that the badge analyser is visible again could we not have a sticky in that category explaining how to use costs to determine whether a query will impact performance?

I’ve found out the hard way what happens when bad queries aren’t resolved prior to other operations. Rebuilding with a test badge enabled did some fairly horrible things.

Community are different, and different are goals and badges.
Take a look to my badges:
http://community.nethserver.org/badges
And to this discussion:

1 Like

These can now be found using the sql-triggered-badge tag in the data & reporting category