How to delete system queries in Data Explorer?

AI-generated summary

A user, Konrad_Sopala, asked if it’s possible to delete system queries in Data Explorer, as they find them unhelpful. maiki suggested sorting them to the bottom, but this didn’t help. sam initially stated that deleting system queries isn’t supported, but mentioned a potential future feature to “soft delete” (hide) them. Konrad_Sopala expressed interest in this feature.

RickyC0626 later announced that a “delete” feature has been implemented, which soft deletes (hides) queries, including system ones. Additionally, rake tasks are available to list hidden queries, hide or unhide queries by ID, and hard delete hidden queries. sam notified Konrad_Sopala that the change would be live on their instance shortly.

Hey there!

We don’t find the system queries inside our Data Explorer to be helpful. Can we somehow delete them? Thanks for help!

1 Like

I don’t believe so, but I wanted to point out they sort by the ones being run. All my system queries are at the bottom, maybe something you can live with. :slight_smile:

3 Likes

Thanks but unfortunately that doesn’t help at all

Unfortunately we don’t support delete here. We will keep this in mind, I think we can support the ability for you to “soft delete” so particular system queries are hidden. They are all keyed.

5 Likes

Sounds perfect! Looking forward to this feature being released as it will simply get rid of some mess with unused queries in the Data Explorer. Thanks!

You can now “delete” all queries, including system ones. The delete button’s functionality will be same from the user’s perspective, but will only soft delete (hide) queries. There are also rake tasks available if you ever want to:

  • see which queries are hidden
rake data_explorer:list_hidden_queries
  • hide visible queries by ID (one or multiple)
rake data_explorer[id]
rake data_explorer[id1,id2,id3]

rake data_explorer[1]
rake data_explorer[-1,2,-3]
  • unhide hidden queries by ID (one or multiple)
rake data_explorer:unhide_query[id]
rake data_explorer:unhide_query[id1,id2,id3]

rake data_explorer:unhide_query[1]
rake data_explorer:unhide_query[-1,2,-3]
  • hard delete hidden queries by ID (one or multiple)
rake data_explorer:hard_delete[id]
rake data_explorer:hard_delete[id1,id2,id3]

rake data_explorer:hard_delete[1]
rake data_explorer:hard_delete[-1,2-3]

https://github.com/discourse/discourse-data-explorer/commit/dcfb92d7f895bf749cbe962997a15d2961d2272f

4 Likes

@Konrad_Sopala just letting you know the change will be live on your instance in 10 minutes or so!

:confetti_ball: thanks for the feature @RickyC0626!

3 Likes

This topic was automatically closed after 31 hours. New replies are no longer allowed.