django-sql-explorer icon indicating copy to clipboard operation
django-sql-explorer copied to clipboard

Allow users to 'favorite' queries

Open chrisclark opened this issue 9 years ago • 4 comments

As an organization grows, it becomes increasingly hard to find your go-to queries. Favorites would help this (and probably replace the 'top x most run' section at the top of the index page)

chrisclark avatar Jun 09 '15 22:06 chrisclark

Sounds good! The other option is to allow for reports to be categorized in some way; or for the use of #hashtags or keywords that can be assigned to a report; together with a function that allows users to pull together sets of #hashtags / keywords and give each those of those sets their own title (effectively "grouping" related reports).

gamesbook avatar Jul 23 '15 06:07 gamesbook

(late reply)

You actually can, sort of, categorize queries today. If you name your queries like:

Marketing - Last Month's Sales Marketing - Next Month's Sales

etc.

Then explorer will render them in the query list view with a "Marketing" header, and "Last Month's Sales" and "Next Month's Sales" as sub-items under that header. Clicking the header will collapse/expand the sub-items. It's not the best, but you at least use to lend some sort of organization to the query list.

chrisclark avatar Jan 30 '16 00:01 chrisclark

This is by no means the same thing, but I did just make a change so that explorer shows the most recently run queries by the current user at the top of the query list pane, rather than the most recently run queries explorer-wide. Definitely a nice improvement for those users who mostly rely on Explorer for just a handful of reports!

chrisclark avatar Aug 08 '17 02:08 chrisclark

@chrisclark Have you pushed this change to the repo? It seems like a good, configurable option to have.

gamesbook avatar Oct 10 '17 17:10 gamesbook

@marksweb the project does now displays the user's most recently run queries (see below) So I believe in combination with the naming convention mentioned above we can close this one

        qll = QueryLog.objects.filter(
            run_by_user=self.request.user, query_id__isnull=False
        ).order_by(
            '-run_at'
        ).select_related('query')

lawson89 avatar Dec 16 '22 15:12 lawson89

@lawson89 I still like the idea of favourites as well as recents.

When I've come close to starting this I've thought of using an M2M with custom through model incase any extra data or logic needs to manage the relationship

marksweb avatar Dec 16 '22 16:12 marksweb

Ok sounds good, shouldn't be too bad to implement. After I finish the triage I'll take a crack at it

lawson89 avatar Dec 16 '22 16:12 lawson89

@marksweb where would you want the favorites to display? As a new menu item - My Favorites ?

lawson89 avatar Dec 22 '22 11:12 lawson89

@marksweb this one should be ok to close now?

lawson89 avatar Jan 24 '23 10:01 lawson89

@lawson89 Yeah. I'm waiting for this to merge before I release; https://github.com/pypa/trove-classifiers/pull/128

marksweb avatar Jan 24 '23 11:01 marksweb